rust/tests/compile-fail/validity/invalid_enum_discriminant.rs

9 lines
192 B
Rust
Raw Normal View History

2016-06-22 04:11:51 -05:00
#[repr(C)]
pub enum Foo {
A, B, C, D
}
fn main() {
2020-05-01 03:29:39 -05:00
let _f = unsafe { std::mem::transmute::<i32, Foo>(42) }; //~ ERROR encountered 0x0000002a, but expected a valid enum discriminant
2018-08-25 04:07:21 -05:00
}