File tree 3 files changed +46
-0
lines changed
3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -61,3 +61,34 @@ fn bindgen_test_layout_SizedIntegers() {
61
61
)
62
62
) ;
63
63
}
64
+ #[ repr( C ) ]
65
+ #[ derive( Debug , Default , Copy , Clone ) ]
66
+ pub struct StructWithBlocklistedFwdDecl {
67
+ pub b : u8 ,
68
+ }
69
+ #[ test]
70
+ fn bindgen_test_layout_StructWithBlocklistedFwdDecl ( ) {
71
+ assert_eq ! (
72
+ :: std:: mem:: size_of:: <StructWithBlocklistedFwdDecl >( ) ,
73
+ 1usize ,
74
+ concat!( "Size of: " , stringify!( StructWithBlocklistedFwdDecl ) )
75
+ ) ;
76
+ assert_eq ! (
77
+ :: std:: mem:: align_of:: <StructWithBlocklistedFwdDecl >( ) ,
78
+ 1usize ,
79
+ concat!( "Alignment of " , stringify!( StructWithBlocklistedFwdDecl ) )
80
+ ) ;
81
+ assert_eq ! (
82
+ unsafe {
83
+ & ( * ( :: std:: ptr:: null:: <StructWithBlocklistedFwdDecl >( ) ) ) . b
84
+ as * const _ as usize
85
+ } ,
86
+ 0usize ,
87
+ concat!(
88
+ "Offset of field: " ,
89
+ stringify!( StructWithBlocklistedFwdDecl ) ,
90
+ "::" ,
91
+ stringify!( b)
92
+ )
93
+ ) ;
94
+ }
Original file line number Diff line number Diff line change 1
1
// bindgen-flags: --blocklist-file ".*/blocklisted/file.*" -- -Itests/headers
2
2
3
+ // Forward declaration of struct that's defined in a blocklisted file.
4
+ struct StructWithBlocklistedDefinition ;
5
+
3
6
#include " blocklisted/file.hpp"
4
7
#include " blocklisted/fake-stdint.h"
5
8
@@ -8,3 +11,8 @@ struct SizedIntegers {
8
11
uint16_t y;
9
12
uint32_t z;
10
13
};
14
+
15
+ // Actual definition of struct that has a forward declaration in a blocklisted file.
16
+ struct StructWithBlocklistedFwdDecl {
17
+ uint8_t b;
18
+ };
Original file line number Diff line number Diff line change @@ -17,3 +17,10 @@ namespace foo {
17
17
namespace bar {
18
18
void NamespacedFunction ();
19
19
}
20
+
21
+
22
+ struct StructWithBlocklistedFwdDecl ;
23
+
24
+ struct StructWithBlocklistedDefinition {
25
+ StructWithBlocklistedFwdDecl* other;
26
+ };
You can’t perform that action at this time.
0 commit comments