]> git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/conflicting-repr-hints.rs
New upstream version 1.27.1+dfsg1
[rustc.git] / src / test / compile-fail / conflicting-repr-hints.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
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.
10
11 #![allow(dead_code)]
12 #![feature(repr_packed)]
13
14 #[repr(C)]
15 enum A { A }
16
17 #[repr(u64)]
18 enum B { B }
19
20 #[repr(C, u64)] //~ WARNING conflicting representation hints
21 enum C { C }
22
23 #[repr(u32, u64)] //~ WARNING conflicting representation hints
24 enum D { D }
25
26 #[repr(C, packed)]
27 struct E(i32);
28
29 #[repr(packed, align(8))]
30 struct F(i32); //~ ERROR type has conflicting packed and align representation hints
31
32 #[repr(packed)]
33 #[repr(align(8))]
34 struct G(i32); //~ ERROR type has conflicting packed and align representation hints
35
36 #[repr(align(8))]
37 #[repr(packed)]
38 struct H(i32); //~ ERROR type has conflicting packed and align representation hints
39
40 #[repr(packed, packed(2))]
41 struct I(i32); //~ ERROR type has conflicting packed representation hints
42
43 #[repr(packed(2))]
44 #[repr(packed)]
45 struct J(i32); //~ ERROR type has conflicting packed representation hints
46
47 #[repr(packed, packed(1))]
48 struct K(i32);
49
50 #[repr(packed, align(8))]
51 union X { //~ ERROR type has conflicting packed and align representation hints
52 i: i32
53 }
54
55 #[repr(packed)]
56 #[repr(align(8))]
57 union Y { //~ ERROR type has conflicting packed and align representation hints
58 i: i32
59 }
60
61 #[repr(align(8))]
62 #[repr(packed)]
63 union Z { //~ ERROR type has conflicting packed and align representation hints
64 i: i32
65 }
66
67 fn main() {}