2021-03-25 12:44:30 +01:00
|
|
|
// Some optimizations remove ZST accesses, thus masking this UB.
|
2022-07-08 16:08:32 +00:00
|
|
|
//@compile-flags: -Zmir-opt-level=0
|
2021-03-25 12:44:30 +01:00
|
|
|
|
2021-04-15 10:00:39 +02:00
|
|
|
#[allow(deref_nullptr)]
|
2018-09-15 16:35:37 +02:00
|
|
|
fn main() {
|
2022-07-11 11:44:55 +00:00
|
|
|
let x: () = unsafe { *std::ptr::null() }; //~ ERROR: dereferencing pointer failed: null pointer is a dangling pointer
|
2018-09-15 16:35:37 +02:00
|
|
|
panic!("this should never print: {:?}", x);
|
|
|
|
}
|