@@ -29,10 +29,16 @@ extern "C" {
29
29
pub fn bar ( foo : Foo < :: std:: os:: raw:: c_int > ) ;
30
30
}
31
31
#[ repr( C ) ]
32
+ #[ derive( Debug , Copy , Clone ) ]
33
+ pub struct mozilla_Foo {
34
+ _unused : [ u8 ; 0 ] ,
35
+ }
36
+ #[ repr( C ) ]
32
37
#[ derive( Debug , Copy , Hash ) ]
33
38
pub struct C {
34
39
pub mB : B < :: std:: os:: raw:: c_uint > ,
35
40
pub mBConstPtr : B < * const :: std:: os:: raw:: c_int > ,
41
+ pub mBConstStructPtr : B < * const mozilla_Foo > ,
36
42
pub mBConst : B < :: std:: os:: raw:: c_int > ,
37
43
pub mBVolatile : B < :: std:: os:: raw:: c_int > ,
38
44
pub mBConstBool : B < bool > ,
@@ -41,7 +47,7 @@ pub struct C {
41
47
}
42
48
#[ test]
43
49
fn bindgen_test_layout_C ( ) {
44
- assert_eq ! ( :: std:: mem:: size_of:: <C >( ) , 32usize , concat ! (
50
+ assert_eq ! ( :: std:: mem:: size_of:: <C >( ) , 40usize , concat ! (
45
51
"Size of: " , stringify ! ( C ) ) ) ;
46
52
assert_eq ! ( :: std:: mem:: align_of:: <C >( ) , 8usize , concat ! (
47
53
"Alignment of " , stringify ! ( C ) ) ) ;
@@ -54,29 +60,34 @@ fn bindgen_test_layout_C() {
54
60
} , 8usize , concat ! (
55
61
"Alignment of field: " , stringify ! ( C ) , "::" , stringify
56
62
! ( mBConstPtr ) ) ) ;
63
+ assert_eq ! ( unsafe {
64
+ & ( * ( 0 as * const C ) ) . mBConstStructPtr as * const _ as
65
+ usize } , 16usize , concat ! (
66
+ "Alignment of field: " , stringify ! ( C ) , "::" , stringify
67
+ ! ( mBConstStructPtr ) ) ) ;
57
68
assert_eq ! ( unsafe {
58
69
& ( * ( 0 as * const C ) ) . mBConst as * const _ as usize } ,
59
- 16usize , concat ! (
70
+ 24usize , concat ! (
60
71
"Alignment of field: " , stringify ! ( C ) , "::" , stringify
61
72
! ( mBConst ) ) ) ;
62
73
assert_eq ! ( unsafe {
63
74
& ( * ( 0 as * const C ) ) . mBVolatile as * const _ as usize
64
- } , 20usize , concat ! (
75
+ } , 28usize , concat ! (
65
76
"Alignment of field: " , stringify ! ( C ) , "::" , stringify
66
77
! ( mBVolatile ) ) ) ;
67
78
assert_eq ! ( unsafe {
68
79
& ( * ( 0 as * const C ) ) . mBConstBool as * const _ as usize
69
- } , 24usize , concat ! (
80
+ } , 32usize , concat ! (
70
81
"Alignment of field: " , stringify ! ( C ) , "::" , stringify
71
82
! ( mBConstBool ) ) ) ;
72
83
assert_eq ! ( unsafe {
73
84
& ( * ( 0 as * const C ) ) . mBConstChar as * const _ as usize
74
- } , 26usize , concat ! (
85
+ } , 34usize , concat ! (
75
86
"Alignment of field: " , stringify ! ( C ) , "::" , stringify
76
87
! ( mBConstChar ) ) ) ;
77
88
assert_eq ! ( unsafe {
78
89
& ( * ( 0 as * const C ) ) . mBArray as * const _ as usize } ,
79
- 28usize , concat ! (
90
+ 36usize , concat ! (
80
91
"Alignment of field: " , stringify ! ( C ) , "::" , stringify
81
92
! ( mBArray ) ) ) ;
82
93
}
@@ -331,6 +342,17 @@ fn __bindgen_test_layout_B_open0_ptr_const_int_close0_instantiation() {
331
342
B <* const :: std:: os:: raw:: c_int> ) ) ) ;
332
343
}
333
344
#[ test]
345
+ fn __bindgen_test_layout_B_open0_ptr_const_mozilla__Foo_close0_instantiation ( ) {
346
+ assert_eq ! ( :: std:: mem:: size_of:: <B <* const mozilla_Foo>>( ) , 8usize ,
347
+ concat ! (
348
+ "Size of template specialization: " , stringify ! (
349
+ B <* const mozilla_Foo> ) ) ) ;
350
+ assert_eq ! ( :: std:: mem:: align_of:: <B <* const mozilla_Foo>>( ) , 8usize ,
351
+ concat ! (
352
+ "Alignment of template specialization: " , stringify ! (
353
+ B <* const mozilla_Foo> ) ) ) ;
354
+ }
355
+ #[ test]
334
356
fn __bindgen_test_layout_B_open0_const_int_close0_instantiation ( ) {
335
357
assert_eq ! ( :: std:: mem:: size_of:: <B <:: std:: os:: raw:: c_int>>( ) , 4usize ,
336
358
concat ! (
0 commit comments