summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-eval/union_promotion.rs
blob: 7167f88a1185be1b2609077048f54b6237bcca5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#![allow(const_err)]

#[repr(C)]
union Foo {
    a: &'static u32,
    b: usize,
}

fn main() {
    let x: &'static bool = &unsafe { //~ temporary value dropped while borrowed
        Foo { a: &1 }.b == Foo { a: &2 }.b
    };
}