]>
Commit | Line | Data |
---|---|---|
5869c6ff XL |
1 | // ignore-32bit |
2 | // This test gives a different error on 32-bit architectures. | |
cdc7bbd5 | 3 | // stderr-per-bitwidth |
5869c6ff XL |
4 | |
5 | union Transmute<T: Copy, U: Copy> { | |
6 | t: T, | |
7 | u: U, | |
8 | } | |
9 | trait Bar { | |
10 | fn bar(&self) -> u32; | |
11 | } | |
12 | struct Foo { | |
13 | foo: u32, | |
14 | bar: bool, | |
15 | } | |
16 | impl Bar for Foo { | |
17 | fn bar(&self) -> u32 { | |
18 | self.foo | |
19 | } | |
20 | } | |
21 | #[derive(Copy, Clone)] | |
22 | struct Fat<'a>(&'a Foo, &'static VTable); | |
23 | struct VTable { | |
24 | size: Foo, | |
25 | } | |
26 | const FOO: &dyn Bar = &Foo { | |
27 | foo: 128, | |
28 | bar: false, | |
29 | }; | |
30 | const G: Fat = unsafe { Transmute { t: FOO }.u }; | |
31 | //~^ ERROR it is undefined behavior to use this value | |
32 | ||
33 | fn main() {} |