]>
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. | |
cc61c64b XL |
10 | #![feature(attr_literals)] |
11 | #![feature(repr_align)] | |
3b2f2976 | 12 | #![feature(untagged_unions)] |
cc61c64b | 13 | #![allow(dead_code)] |
223e47cc | 14 | |
cc61c64b | 15 | #[repr(align(16))] |
3b2f2976 | 16 | struct SA(i32); |
223e47cc | 17 | |
3b2f2976 XL |
18 | struct SB(SA); |
19 | ||
20 | #[repr(align(16))] | |
21 | union UA { | |
22 | i: i32 | |
23 | } | |
24 | ||
25 | union UB { | |
26 | a: UA | |
27 | } | |
28 | ||
29 | #[repr(packed)] | |
30 | struct SC(SA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
31 | ||
32 | #[repr(packed)] | |
33 | struct SD(SB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
34 | ||
35 | #[repr(packed)] | |
36 | struct SE(UA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
37 | ||
38 | #[repr(packed)] | |
39 | struct SF(UB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
40 | ||
41 | #[repr(packed)] | |
42 | union UC { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
43 | a: UA | |
44 | } | |
45 | ||
46 | #[repr(packed)] | |
47 | union UD { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | |
48 | n: UB | |
49 | } | |
b039eaaf | 50 | |
cc61c64b | 51 | #[repr(packed)] |
3b2f2976 XL |
52 | union UE { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type |
53 | a: SA | |
54 | } | |
cc61c64b XL |
55 | |
56 | #[repr(packed)] | |
3b2f2976 XL |
57 | union UF { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type |
58 | n: SB | |
59 | } | |
cc61c64b XL |
60 | |
61 | fn main() {} |