rust/tests/fail/function_pointers/cast_fn_ptr4.rs
2022-07-11 11:48:56 +00:00

8 lines
250 B
Rust

fn main() {
fn f(_: *const [i32]) {}
let g = unsafe { std::mem::transmute::<fn(*const [i32]), fn(*const i32)>(f) };
g(&42 as *const i32) //~ ERROR: calling a function with argument of type *const [i32] passing data of type *const i32
}