summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/const-eval/const_raw_ptr_ops2.rs')
-rw-r--r--tests/ui/consts/const-eval/const_raw_ptr_ops2.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs b/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs
new file mode 100644
index 000000000..ec5508a1e
--- /dev/null
+++ b/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs
@@ -0,0 +1,10 @@
+fn main() {}
+
+// fine
+const Z: i32 = unsafe { *(&1 as *const i32) };
+
+// bad, will thus error in miri
+const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR evaluation of constant value failed
+//~| is a dangling pointer
+const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR evaluation of constant value failed
+//~| is a dangling pointer