rust/tests/compile-fail/function_pointers/deref_fn_ptr.rs
2020-04-11 11:36:55 +02:00

9 lines
184 B
Rust

fn f() {}
fn main() {
let x: u8 = unsafe {
*std::mem::transmute::<fn(), *const u8>(f) //~ ERROR contains a function
};
panic!("this should never print: {}", x);
}