summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-eval/union_promotion.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/const-eval/union_promotion.rs')
-rw-r--r--tests/ui/consts/const-eval/union_promotion.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/consts/const-eval/union_promotion.rs b/tests/ui/consts/const-eval/union_promotion.rs
new file mode 100644
index 000000000..18894c45f
--- /dev/null
+++ b/tests/ui/consts/const-eval/union_promotion.rs
@@ -0,0 +1,11 @@
+#[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
+ };
+}