File tree 3 files changed +53
-0
lines changed
3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -1517,6 +1517,10 @@ impl CompInfo {
1517
1517
} ) {
1518
1518
info ! ( "Found a struct that was defined within `#pragma packed(...)`" ) ;
1519
1519
return true ;
1520
+ } else if self . has_own_virtual_method {
1521
+ if parent_layout. align == 1 {
1522
+ return true ;
1523
+ }
1520
1524
}
1521
1525
}
1522
1526
Original file line number Diff line number Diff line change
1
+ /* automatically generated by rust-bindgen */
2
+
3
+ #![ allow(
4
+ dead_code,
5
+ non_snake_case,
6
+ non_camel_case_types,
7
+ non_upper_case_globals
8
+ ) ]
9
+ #![ cfg( feature = "nightly" ) ]
10
+
11
+ #[ repr( C ) ]
12
+ pub struct PackedVtable__bindgen_vtable ( :: std:: os:: raw:: c_void ) ;
13
+ #[ repr( C , packed) ]
14
+ #[ derive( Debug ) ]
15
+ pub struct PackedVtable {
16
+ pub vtable_ : * const PackedVtable__bindgen_vtable ,
17
+ }
18
+ #[ test]
19
+ fn bindgen_test_layout_PackedVtable ( ) {
20
+ assert_eq ! (
21
+ :: std:: mem:: size_of:: <PackedVtable >( ) ,
22
+ 8usize ,
23
+ concat!( "Size of: " , stringify!( PackedVtable ) )
24
+ ) ;
25
+ assert_eq ! (
26
+ :: std:: mem:: align_of:: <PackedVtable >( ) ,
27
+ 1usize ,
28
+ concat!( "Alignment of " , stringify!( PackedVtable ) )
29
+ ) ;
30
+ }
31
+ impl Default for PackedVtable {
32
+ fn default ( ) -> Self {
33
+ unsafe { :: std:: mem:: zeroed ( ) }
34
+ }
35
+ }
36
+ extern "C" {
37
+ #[ link_name = "\u{1} _ZN12PackedVtableD1Ev" ]
38
+ pub fn PackedVtable_PackedVtable_destructor ( this : * mut PackedVtable ) ;
39
+ }
Original file line number Diff line number Diff line change
1
+ // bindgen-flags: --raw-line '#![cfg(feature = "nightly")]' --rust-target 1.33 -- -x c++ -std=c++11
2
+
3
+ #pragma pack(1)
4
+
5
+ // This should be packed.
6
+ struct PackedVtable {
7
+ virtual ~PackedVtable ();
8
+ };
9
+
10
+ #pragma pack()
You can’t perform that action at this time.
0 commit comments