diff options
-rw-r--r-- | src/ir/context.rs | 3 | ||||
-rw-r--r-- | tests/expectations/tests/underscore.rs | 40 | ||||
-rw-r--r-- | tests/headers/underscore.hpp | 3 |
3 files changed, 45 insertions, 1 deletions
diff --git a/src/ir/context.rs b/src/ir/context.rs index cc1baf90..b2c53aac 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -680,7 +680,8 @@ impl BindgenContext { "where" | "while" | "yield" | - "bool" => true, + "bool" | + "_" => true, _ => false, } { diff --git a/tests/expectations/tests/underscore.rs b/tests/expectations/tests/underscore.rs new file mode 100644 index 00000000..d1b0ccc2 --- /dev/null +++ b/tests/expectations/tests/underscore.rs @@ -0,0 +1,40 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +pub const __: ::std::os::raw::c_int = 10; +#[repr(C)] +#[derive(Debug, Default, Copy)] +pub struct ptr_t { + pub __: [::std::os::raw::c_uchar; 8usize], +} +#[test] +fn bindgen_test_layout_ptr_t() { + assert_eq!( + ::std::mem::size_of::<ptr_t>(), + 8usize, + concat!("Size of: ", stringify!(ptr_t)) + ); + assert_eq!( + ::std::mem::align_of::<ptr_t>(), + 1usize, + concat!("Alignment of ", stringify!(ptr_t)) + ); + assert_eq!( + unsafe { &(*(0 as *const ptr_t)).__ as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(ptr_t), + "::", + stringify!(__) + ) + ); +} +impl Clone for ptr_t { + fn clone(&self) -> Self { + *self + } +} diff --git a/tests/headers/underscore.hpp b/tests/headers/underscore.hpp new file mode 100644 index 00000000..1c9371f1 --- /dev/null +++ b/tests/headers/underscore.hpp @@ -0,0 +1,3 @@ +const int _ = 10; + +typedef struct { unsigned char _[8]; } ptr_t;
\ No newline at end of file |