rust/tests/fail/validity/invalid_bool_uninit.rs

11 lines
189 B
Rust

#![allow(invalid_value)]
union MyUninit {
init: (),
uninit: [bool; 1],
}
fn main() {
let _b = unsafe { MyUninit { init: () }.uninit }; //~ ERROR: constructing invalid value
}