summaryrefslogtreecommitdiffstats
path: root/tests/ui/repr/repr-packed-contains-align.rs
blob: bef5c7d8c62fcb49902567fb535e1928051cf003 (plain)
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
#![allow(dead_code)]

#[repr(align(16))]
#[derive(Clone, Copy)]
struct SA(i32);

#[derive(Clone, Copy)]
struct SB(SA);

#[repr(align(16))]
#[derive(Clone, Copy)]
union UA {
    i: i32
}

#[derive(Clone, Copy)]
union UB {
    a: UA
}

#[repr(packed)]
struct SC(SA); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type

#[repr(packed)]
struct SD(SB); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type

#[repr(packed)]
struct SE(UA); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type

#[repr(packed)]
struct SF(UB); //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type

#[repr(packed)]
union UC { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
    a: UA
}

#[repr(packed)]
union UD { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
    n: UB
}

#[repr(packed)]
union UE { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
    a: SA
}

#[repr(packed)]
union UF { //~ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
    n: SB
}

fn main() {}