@@ -15,11 +15,42 @@ pub struct Foo<T> {
15
15
impl < T > Default for Foo < T > {
16
16
fn default ( ) -> Self { unsafe { :: std:: mem:: zeroed ( ) } }
17
17
}
18
+ #[ repr( C ) ]
19
+ #[ derive( Debug , Copy , Clone ) ]
20
+ pub struct B < T > {
21
+ pub m_member : T ,
22
+ pub _phantom_0 : :: std:: marker:: PhantomData < :: std:: cell:: UnsafeCell < T > > ,
23
+ }
24
+ impl < T > Default for B < T > {
25
+ fn default ( ) -> Self { unsafe { :: std:: mem:: zeroed ( ) } }
26
+ }
18
27
extern "C" {
19
28
#[ link_name = "_Z3bar3FooIiiE" ]
20
29
pub fn bar ( foo : Foo < :: std:: os:: raw:: c_int > ) ;
21
30
}
22
31
#[ repr( C ) ]
32
+ #[ derive( Debug , Copy ) ]
33
+ pub struct C {
34
+ pub mB : B < :: std:: os:: raw:: c_uint > ,
35
+ }
36
+ #[ test]
37
+ fn bindgen_test_layout_C ( ) {
38
+ assert_eq ! ( :: std:: mem:: size_of:: <C >( ) , 4usize , concat ! (
39
+ "Size of: " , stringify ! ( C ) ) ) ;
40
+ assert_eq ! ( :: std:: mem:: align_of:: <C >( ) , 4usize , concat ! (
41
+ "Alignment of " , stringify ! ( C ) ) ) ;
42
+ assert_eq ! ( unsafe { & ( * ( 0 as * const C ) ) . mB as * const _ as usize
43
+ } , 0usize , concat ! (
44
+ "Alignment of field: " , stringify ! ( C ) , "::" , stringify
45
+ ! ( mB ) ) ) ;
46
+ }
47
+ impl Clone for C {
48
+ fn clone ( & self ) -> Self { * self }
49
+ }
50
+ impl Default for C {
51
+ fn default ( ) -> Self { unsafe { :: std:: mem:: zeroed ( ) } }
52
+ }
53
+ #[ repr( C ) ]
23
54
#[ derive( Debug ) ]
24
55
pub struct D {
25
56
pub m_foo : D_MyFoo ,
@@ -245,6 +276,17 @@ fn __bindgen_test_layout_Foo_open0_int_int_close0_instantiation() {
245
276
Foo <:: std:: os:: raw:: c_int> ) ) ) ;
246
277
}
247
278
#[ test]
279
+ fn __bindgen_test_layout_B_open0_unsigned_int_close0_instantiation ( ) {
280
+ assert_eq ! ( :: std:: mem:: size_of:: <B <:: std:: os:: raw:: c_uint>>( ) , 4usize ,
281
+ concat ! (
282
+ "Size of template specialization: " , stringify ! (
283
+ B <:: std:: os:: raw:: c_uint> ) ) ) ;
284
+ assert_eq ! ( :: std:: mem:: align_of:: <B <:: std:: os:: raw:: c_uint>>( ) , 4usize ,
285
+ concat ! (
286
+ "Alignment of template specialization: " , stringify ! (
287
+ B <:: std:: os:: raw:: c_uint> ) ) ) ;
288
+ }
289
+ #[ test]
248
290
fn __bindgen_test_layout_Foo_open0_int_int_close0_instantiation_1 ( ) {
249
291
assert_eq ! ( :: std:: mem:: size_of:: <Foo <:: std:: os:: raw:: c_int>>( ) , 24usize ,
250
292
concat ! (
@@ -256,7 +298,7 @@ fn __bindgen_test_layout_Foo_open0_int_int_close0_instantiation_1() {
256
298
Foo <:: std:: os:: raw:: c_int> ) ) ) ;
257
299
}
258
300
#[ test]
259
- fn __bindgen_test_layout_Rooted_open0__bindgen_ty_id_108_close0_instantiation ( ) {
301
+ fn __bindgen_test_layout_Rooted_open0__bindgen_ty_id_118_close0_instantiation ( ) {
260
302
assert_eq ! ( :: std:: mem:: size_of:: <Rooted <* mut :: std:: os:: raw:: c_void>>( ) ,
261
303
24usize , concat ! (
262
304
"Size of template specialization: " , stringify ! (
@@ -267,7 +309,7 @@ fn __bindgen_test_layout_Rooted_open0__bindgen_ty_id_108_close0_instantiation()
267
309
Rooted <* mut :: std:: os:: raw:: c_void> ) ) ) ;
268
310
}
269
311
#[ test]
270
- fn __bindgen_test_layout_Rooted_open0__bindgen_ty_id_114_close0_instantiation ( ) {
312
+ fn __bindgen_test_layout_Rooted_open0__bindgen_ty_id_124_close0_instantiation ( ) {
271
313
assert_eq ! ( :: std:: mem:: size_of:: <Rooted <* mut :: std:: os:: raw:: c_void>>( ) ,
272
314
24usize , concat ! (
273
315
"Size of template specialization: " , stringify ! (
0 commit comments