diff options
-rw-r--r-- | libbindgen/tests/expectations/tests/virtual_inheritance.rs | 68 | ||||
-rw-r--r-- | libbindgen/tests/headers/virtual_inheritance.hpp | 16 |
2 files changed, 84 insertions, 0 deletions
diff --git a/libbindgen/tests/expectations/tests/virtual_inheritance.rs b/libbindgen/tests/expectations/tests/virtual_inheritance.rs new file mode 100644 index 00000000..f271223f --- /dev/null +++ b/libbindgen/tests/expectations/tests/virtual_inheritance.rs @@ -0,0 +1,68 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +#[repr(C)] +#[derive(Debug, Copy)] +pub struct A { + pub foo: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_A() { + assert_eq!(::std::mem::size_of::<A>() , 4usize); + assert_eq!(::std::mem::align_of::<A>() , 4usize); +} +impl Clone for A { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +pub struct B__bindgen_vtable { +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct B { + pub vtable_: *const B__bindgen_vtable, + pub bar: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_B() { + assert_eq!(::std::mem::size_of::<B>() , 16usize); + assert_eq!(::std::mem::align_of::<B>() , 8usize); +} +impl Clone for B { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +pub struct C__bindgen_vtable { +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct C { + pub vtable_: *const C__bindgen_vtable, + pub baz: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_C() { + assert_eq!(::std::mem::size_of::<C>() , 16usize); + assert_eq!(::std::mem::align_of::<C>() , 8usize); +} +impl Clone for C { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct D { + pub _base: C, + pub _base_1: B, + pub bazz: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_D() { + assert_eq!(::std::mem::size_of::<D>() , 40usize); + assert_eq!(::std::mem::align_of::<D>() , 8usize); +} +impl Clone for D { + fn clone(&self) -> Self { *self } +} diff --git a/libbindgen/tests/headers/virtual_inheritance.hpp b/libbindgen/tests/headers/virtual_inheritance.hpp new file mode 100644 index 00000000..5198c51e --- /dev/null +++ b/libbindgen/tests/headers/virtual_inheritance.hpp @@ -0,0 +1,16 @@ + +class A { + int foo; +}; + +class B: public virtual A { + int bar; +}; + +class C: public virtual A { + int baz; +}; + +class D: public C, public B { + int bazz; +}; |