1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#![allow(incomplete_features)]
#![feature(unnamed_fields)]
struct A { //~ ERROR struct with unnamed fields must have `#[repr(C)]` representation
//~^ NOTE struct `A` defined here
_: struct { //~ NOTE unnamed field defined here
a: i32,
},
_: struct { //~ NOTE unnamed field defined here
_: struct {
b: i32,
},
},
}
union B { //~ ERROR union with unnamed fields must have `#[repr(C)]` representation
//~^ NOTE union `B` defined here
_: union { //~ NOTE unnamed field defined here
a: i32,
},
_: union { //~ NOTE unnamed field defined here
_: union {
b: i32,
},
},
}
#[derive(Clone, Copy)]
#[repr(C)]
struct Foo {}
#[derive(Clone, Copy)]
struct Bar {}
//~^ `Bar` defined here
//~| `Bar` defined here
//~| `Bar` defined here
//~| `Bar` defined here
struct C { //~ ERROR struct with unnamed fields must have `#[repr(C)]` representation
//~^ NOTE struct `C` defined here
_: Foo, //~ NOTE unnamed field defined here
}
union D { //~ ERROR union with unnamed fields must have `#[repr(C)]` representation
//~^ NOTE union `D` defined here
_: Foo, //~ NOTE unnamed field defined here
}
#[repr(C)]
struct E {
_: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
//~^ NOTE unnamed field defined here
_: struct {
_: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
//~^ NOTE unnamed field defined here
},
}
#[repr(C)]
union F {
_: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
//~^ NOTE unnamed field defined here
_: union {
_: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
//~^ NOTE unnamed field defined here
},
}
fn main() {}
|