Files
rust/tests/compile-fail/deref_fn_ptr.rs
2016-06-13 15:33:05 +02:00

9 lines
207 B
Rust

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