]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const-eval/double_check.rs
Rollup merge of #105172 - alexs-sh:issue-98861-fix-next, r=scottmcm
[rust.git] / tests / ui / consts / const-eval / double_check.rs
1 // check-pass
2
3 enum Foo {
4     A = 5,
5     B = 42,
6 }
7 enum Bar {
8     C = 42,
9     D = 99,
10 }
11 #[repr(C)]
12 union Union {
13     foo: &'static Foo,
14     bar: &'static Bar,
15     u8: &'static u8,
16 }
17 static BAR: u8 = 42;
18 static FOO: (&Foo, &Bar) = unsafe {(
19     Union { u8: &BAR }.foo,
20     Union { u8: &BAR }.bar,
21 )};
22
23 static FOO2: (&Foo, &Bar) = unsafe {(std::mem::transmute(&BAR), std::mem::transmute(&BAR))};
24
25 fn main() {}