Skip to content

Commit 12fd256

Browse files
committed
tests: Add virtual base tests.
1 parent 9798d92 commit 12fd256

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(non_snake_case)]
5+
6+
7+
#[repr(C)]
8+
#[derive(Debug, Copy)]
9+
pub struct A {
10+
pub foo: ::std::os::raw::c_int,
11+
}
12+
#[test]
13+
fn bindgen_test_layout_A() {
14+
assert_eq!(::std::mem::size_of::<A>() , 4usize);
15+
assert_eq!(::std::mem::align_of::<A>() , 4usize);
16+
}
17+
impl Clone for A {
18+
fn clone(&self) -> Self { *self }
19+
}
20+
#[repr(C)]
21+
pub struct B__bindgen_vtable {
22+
}
23+
#[repr(C)]
24+
#[derive(Debug, Copy)]
25+
pub struct B {
26+
pub vtable_: *const B__bindgen_vtable,
27+
pub bar: ::std::os::raw::c_int,
28+
}
29+
#[test]
30+
fn bindgen_test_layout_B() {
31+
assert_eq!(::std::mem::size_of::<B>() , 16usize);
32+
assert_eq!(::std::mem::align_of::<B>() , 8usize);
33+
}
34+
impl Clone for B {
35+
fn clone(&self) -> Self { *self }
36+
}
37+
#[repr(C)]
38+
pub struct C__bindgen_vtable {
39+
}
40+
#[repr(C)]
41+
#[derive(Debug, Copy)]
42+
pub struct C {
43+
pub vtable_: *const C__bindgen_vtable,
44+
pub baz: ::std::os::raw::c_int,
45+
}
46+
#[test]
47+
fn bindgen_test_layout_C() {
48+
assert_eq!(::std::mem::size_of::<C>() , 16usize);
49+
assert_eq!(::std::mem::align_of::<C>() , 8usize);
50+
}
51+
impl Clone for C {
52+
fn clone(&self) -> Self { *self }
53+
}
54+
#[repr(C)]
55+
#[derive(Debug, Copy)]
56+
pub struct D {
57+
pub _base: C,
58+
pub _base_1: B,
59+
pub bazz: ::std::os::raw::c_int,
60+
}
61+
#[test]
62+
fn bindgen_test_layout_D() {
63+
assert_eq!(::std::mem::size_of::<D>() , 40usize);
64+
assert_eq!(::std::mem::align_of::<D>() , 8usize);
65+
}
66+
impl Clone for D {
67+
fn clone(&self) -> Self { *self }
68+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
class A {
3+
int foo;
4+
};
5+
6+
class B: public virtual A {
7+
int bar;
8+
};
9+
10+
class C: public virtual A {
11+
int baz;
12+
};
13+
14+
class D: public C, public B {
15+
int bazz;
16+
};

0 commit comments

Comments
 (0)