diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-01-10 23:09:08 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-10 23:09:08 -0800 |
commit | df043bf3dcc11bfd5c22cee5d3c6ba04d41c5f00 (patch) | |
tree | 7fd7ba8d7882a5d68215602d3eba5425600b2efc /libbindgen/tests | |
parent | c77e76c4326b3069963bf292c98eeb99f6364fa2 (diff) | |
parent | 12fd256b082f6e269700b043726f9b8494aba269 (diff) |
Auto merge of #383 - emilio:virtual-base, r=fitzgen
Tidy up and test virtual inheritance handling.
Done while investigating #380.
r? @fitzgen
Diffstat (limited to 'libbindgen/tests')
-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; +}; |