rust/tests/compile-fail/validity/invalid_enum_discriminant.rs
2020-05-01 10:29:39 +02:00

9 lines
192 B
Rust

#[repr(C)]
pub enum Foo {
A, B, C, D
}
fn main() {
let _f = unsafe { std::mem::transmute::<i32, Foo>(42) }; //~ ERROR encountered 0x0000002a, but expected a valid enum discriminant
}