rust/tests/ui/consts/const-deref-ptr.rs
2023-01-11 09:32:08 +00:00

8 lines
220 B
Rust

// 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);
}