summary refs log tree commit diff
path: root/tests/ui/consts/const-deref-ptr.rs
blob: c80cb95ea936ca8b6c94f9b2530825d0070395b5 (plain)
1
2
3
4
5
6
7
8
// 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
    //~| NOTE dangling pointer
    println!("{}", C);
}