rust/tests/compile-fail/null_pointer_deref_zst.rs

5 lines
167 B
Rust
Raw Normal View History

fn main() {
2020-05-01 07:43:59 -05:00
let x: () = unsafe { *std::ptr::null() }; //~ ERROR memory access failed: 0x0 is not a valid pointer
panic!("this should never print: {:?}", x);
}