rust/tests/compile-fail/cast_fn_ptr.rs

11 lines
256 B
Rust
Raw Normal View History

2016-08-27 02:44:46 -05:00
fn main() {
fn f() {}
let g = unsafe {
std::mem::transmute::<fn(), fn(i32)>(f)
};
g(42) //~ ERROR constant evaluation error [E0080]
//~^ NOTE tried to call a function with sig fn() through a function pointer of type fn(i32)
}