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