diff options
author | Amanjeev Sethi <aj@amanjeev.com> | 2022-09-19 19:26:44 -0400 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2022-09-22 21:10:33 -1000 |
commit | c84897d33846b4cf0d8494e20326cbc6fc3bb0d8 (patch) | |
tree | 932141f451fa751b23e00885ee7e86ccb2491cb0 /tests | |
parent | af12c29026517b4bb9ddef58fec23a7e8142fe0b (diff) |
test: add test for GH-422
GitHub issue 422 was fixed but needs a test.
https://github.com/rust-lang/rust-bindgen/issues/422
Signed-off-by: Amanjeev Sethi <aj@amanjeev.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/expectations/tests/inner-typedef-gh422.rs | 37 | ||||
-rw-r--r-- | tests/headers/inner-typedef-gh422.hpp | 11 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/expectations/tests/inner-typedef-gh422.rs b/tests/expectations/tests/inner-typedef-gh422.rs new file mode 100644 index 00000000..1cfa549c --- /dev/null +++ b/tests/expectations/tests/inner-typedef-gh422.rs @@ -0,0 +1,37 @@ +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Foo { + pub _address: u8, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct Foo_InnerType<T> { + pub t: T, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, +} +impl<T> Default for Foo_InnerType<T> { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::<Self>::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type Bar = InnerType; +extern "C" { + #[link_name = "\u{1}_Z4funcv"] + pub fn func() -> Bar; +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct InnerType { + pub _address: u8, +} diff --git a/tests/headers/inner-typedef-gh422.hpp b/tests/headers/inner-typedef-gh422.hpp new file mode 100644 index 00000000..301630a5 --- /dev/null +++ b/tests/headers/inner-typedef-gh422.hpp @@ -0,0 +1,11 @@ +template <typename T> +class Foo { +public: + class InnerType { + T t; + }; +}; + +typedef Foo<int>::InnerType Bar; + +Bar func();
\ No newline at end of file |