Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
- Fixed a panic when generating bindings for Objective-C methods that declare C-style parameters (#3488).
- Fixed a panic when an Objective-C method returns `Class`. The `Class` type is now generated as `*mut objc::runtime::Class` instead of an interface named after the enclosing declaration (#3484).
- Fixed a stack overflow when generating bindings for nested alias template instantiations such as `U<U<int>>` (#3478).
- Fixed a panic when generating bindings for C++20 `char8_t` arrays. `char8_t` is now always generated as `u8`, so enums with a `char8_t` underlying type are unsigned too (#3474, #3464).

## Security

Expand Down
38 changes: 38 additions & 0 deletions bindgen-tests/tests/expectations/tests/char8_t.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions bindgen-tests/tests/headers/char8_t.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// bindgen-flags: -- -std=c++20

extern char8_t global_array[4];
extern char8_t incomplete_array[];
extern char8_t nested_array[2][2];

struct WithChar8Array {
char8_t bytes[8];
char8_t single;
};

void take_char8_array(char8_t input[4]);
char8_t return_char8(char8_t input);

enum class Char8Enum : char8_t {
High = 0xFF,
Low = 0x41,
};
11 changes: 11 additions & 0 deletions bindgen/ir/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2024,6 +2024,17 @@ If you encounter an error missing from this list, please file an issue or a PR!"
}
CXType_Char16 => TypeKind::Int(IntKind::U16),
CXType_Char32 => TypeKind::Int(IntKind::U32),
// libclang has no CXType_Char8, so char8_t shows up as unexposed.
CXType_Unexposed
if ty
.canonical_type()
.spelling()
.split_whitespace()
.filter(|part| !matches!(*part, "const" | "volatile"))
.eq(["char8_t"]) =>
{
TypeKind::Int(IntKind::U8)
}
CXType_Long => TypeKind::Int(IntKind::Long),
CXType_ULong => TypeKind::Int(IntKind::ULong),
CXType_LongLong => TypeKind::Int(IntKind::LongLong),
Expand Down
Loading