summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-deref-ptr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts/const-deref-ptr.rs')
-rw-r--r--src/test/ui/consts/const-deref-ptr.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/ui/consts/const-deref-ptr.rs b/src/test/ui/consts/const-deref-ptr.rs
new file mode 100644
index 000000000..4aca75e3a
--- /dev/null
+++ b/src/test/ui/consts/const-deref-ptr.rs
@@ -0,0 +1,7 @@
+// Check that you can't dereference invalid raw pointers in constants.
+
+fn main() {
+ static C: u64 = unsafe {*(0xdeadbeef as *const u64)};
+ //~^ ERROR could not evaluate static initializer
+ println!("{}", C);
+}