rust/tests/compile-fail/invalid_bool.rs

6 lines
210 B
Rust
Raw Normal View History

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