summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/static-raw-pointer-interning.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/consts/static-raw-pointer-interning.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/consts/static-raw-pointer-interning.rs b/src/test/ui/consts/static-raw-pointer-interning.rs
new file mode 100644
index 000000000..cab60c91e
--- /dev/null
+++ b/src/test/ui/consts/static-raw-pointer-interning.rs
@@ -0,0 +1,15 @@
+// run-pass
+
+static FOO: Foo = Foo {
+ field: &42 as *const i32,
+};
+
+struct Foo {
+ field: *const i32,
+}
+
+unsafe impl Sync for Foo {}
+
+fn main() {
+ assert_eq!(unsafe { *FOO.field }, 42);
+}