]>
Commit | Line | Data |
---|---|---|
32a655c1 | 1 | // Copyright 2017 The Rust Project Developers. See the COPYRIGHT |
223e47cc LB |
2 | // file at the top-level directory of this distribution and at |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
3b2f2976 | 10 | #![feature(untagged_unions)] |
cc61c64b | 11 | #![allow(dead_code)] |
223e47cc | 12 | |
cc61c64b | 13 | #[repr(align(16))] |
3b2f2976 | 14 | struct SA(i32); |
223e47cc | 15 | |
3b2f2976 XL |
16 | struct SB(SA); |
17 | ||
18 | #[repr(align(16))] | |
19 | union UA { | |
20 | i: i32 | |
21 | } | |
22 | ||
23 | union UB { | |
24 | a: UA | |
25 | } | |
26 | ||
27 | #[repr(packed)] | |
28 | struct SC(SA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
29 | ||
30 | #[repr(packed)] | |
31 | struct SD(SB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
32 | ||
33 | #[repr(packed)] | |
34 | struct SE(UA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
35 | ||
36 | #[repr(packed)] | |
37 | struct SF(UB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
38 | ||
39 | #[repr(packed)] | |
40 | union UC { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
41 | a: UA | |
42 | } | |
43 | ||
44 | #[repr(packed)] | |
45 | union UD { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
46 | n: UB | |
47 | } | |
b039eaaf | 48 | |
cc61c64b | 49 | #[repr(packed)] |
3b2f2976 XL |
50 | union UE { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type |
51 | a: SA | |
52 | } | |
cc61c64b XL |
53 | |
54 | #[repr(packed)] | |
3b2f2976 XL |
55 | union UF { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type |
56 | n: SB | |
57 | } | |
cc61c64b XL |
58 | |
59 | fn main() {} |