Files
rust/tests/compile-fail/deref_fn_ptr.rs

14 lines
259 B
Rust
Raw Normal View History

2016-06-13 12:29:01 +02:00
#![feature(custom_attribute)]
#![allow(dead_code, unused_attributes)]
fn f() {}
#[miri_run]
fn deref_fn_ptr() -> i32 {
unsafe {
*std::mem::transmute::<fn(), *const i32>(f) //~ ERROR: tried to dereference a function pointer
}
}
fn main() {}