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

9 lines
184 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() {
let _f = unsafe { std::mem::transmute::<i32, Foo>(42) }; //~ ERROR encountered 42, but expected a valid enum discriminant
2018-08-25 04:07:21 -05:00
}