rust/tests/compile-fail/zst1.rs

6 lines
158 B
Rust
Raw Normal View History

fn main() {
// make sure ZST locals cannot be accessed
let x = &() as *const () as *const i8;
2021-07-15 13:33:08 -05:00
let _val = unsafe { *x }; //~ ERROR out-of-bounds
}