rust/tests/compile-fail/invalid_bool.rs
2017-11-27 14:31:51 +01:00

5 lines
163 B
Rust

fn main() {
let b = unsafe { std::mem::transmute::<u8, bool>(2) };
if b { unreachable!() } else { unreachable!() } //~ ERROR: invalid boolean value read
}