]>
Commit | Line | Data |
---|---|---|
9c376795 FG |
1 | // Strip out raw byte dumps to make comparison platform-independent: |
2 | // normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" | |
3 | // normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP" | |
0bf4aa26 XL |
4 | |
5 | use std::mem; | |
0531ce1d | 6 | |
8faf50e0 XL |
7 | #[derive(Copy, Clone)] |
8 | enum Bar {} | |
0531ce1d | 9 | |
e1599b0c | 10 | #[repr(C)] |
74b04a01 XL |
11 | union MaybeUninit<T: Copy> { |
12 | uninit: (), | |
13 | init: T, | |
0731742a XL |
14 | } |
15 | ||
74b04a01 | 16 | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init }; |
353b0b11 | 17 | //~^ ERROR evaluation of constant value failed |
0bf4aa26 XL |
18 | |
19 | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; | |
a1dfa0c6 | 20 | //~^ ERROR it is undefined behavior to use this value |
0bf4aa26 | 21 | |
74b04a01 | 22 | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init }; |
353b0b11 | 23 | //~^ ERROR evaluation of constant value failed |
0531ce1d | 24 | |
0731742a | 25 | fn main() {} |