summaryrefslogtreecommitdiff
path: root/libbindgen/tests
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-01-06 10:38:24 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-01-06 10:38:24 +0100
commit12fd256b082f6e269700b043726f9b8494aba269 (patch)
tree808b1bdc080154a41d83893fd4609132e73c2514 /libbindgen/tests
parent9798d92212a590fff0d6f5a55d582e1b45781172 (diff)
tests: Add virtual base tests.
Diffstat (limited to 'libbindgen/tests')
-rw-r--r--libbindgen/tests/expectations/tests/virtual_inheritance.rs68
-rw-r--r--libbindgen/tests/headers/virtual_inheritance.hpp16
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;
+};