]> git.proxmox.com Git - rustc.git/blame - src/test/ui/conflicting-repr-hints.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / conflicting-repr-hints.rs
CommitLineData
9e0c209e 1#![allow(dead_code)]
3157f602 2
9e0c209e 3#[repr(C)]
dfeec247
XL
4enum A {
5 A,
6}
5bcae85e 7
9e0c209e 8#[repr(u64)]
dfeec247
XL
9enum B {
10 B,
11}
5bcae85e 12
dfeec247
XL
13#[repr(C, u64)] //~ ERROR conflicting representation hints
14//~^ WARN this was previously accepted
15enum C {
16 C,
17}
a7813a04 18
dfeec247
XL
19#[repr(u32, u64)] //~ ERROR conflicting representation hints
20//~^ WARN this was previously accepted
21enum D {
22 D,
23}
9e0c209e
SL
24
25#[repr(C, packed)]
26struct E(i32);
27
3b2f2976
XL
28#[repr(packed, align(8))]
29struct F(i32); //~ ERROR type has conflicting packed and align representation hints
30
31#[repr(packed)]
32#[repr(align(8))]
33struct G(i32); //~ ERROR type has conflicting packed and align representation hints
34
35#[repr(align(8))]
36#[repr(packed)]
37struct H(i32); //~ ERROR type has conflicting packed and align representation hints
38
83c7162d
XL
39#[repr(packed, packed(2))]
40struct I(i32); //~ ERROR type has conflicting packed representation hints
41
42#[repr(packed(2))]
43#[repr(packed)]
44struct J(i32); //~ ERROR type has conflicting packed representation hints
45
46#[repr(packed, packed(1))]
47struct K(i32);
48
3b2f2976 49#[repr(packed, align(8))]
dfeec247
XL
50union X {
51 //~^ ERROR type has conflicting packed and align representation hints
52 i: i32,
3b2f2976
XL
53}
54
55#[repr(packed)]
56#[repr(align(8))]
dfeec247
XL
57union Y {
58 //~^ ERROR type has conflicting packed and align representation hints
59 i: i32,
3b2f2976
XL
60}
61
62#[repr(align(8))]
63#[repr(packed)]
dfeec247
XL
64union Z {
65 //~^ ERROR type has conflicting packed and align representation hints
66 i: i32,
3b2f2976 67}
cc61c64b 68
136023e0
XL
69#[repr(packed, align(0x100))]
70pub struct S(u16); //~ ERROR type has conflicting packed and align representation hints
71
72#[repr(packed, align(0x100))]
73pub union U { //~ ERROR type has conflicting packed and align representation hints
74 u: u16
75}
76
77static B: U = U { u: 0 };
78static A: S = S(0);
79
cc61c64b 80fn main() {}