]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/fn_ptr_offset.rs
Merge pull request #201 from oli-obk/test_suite_fails
[rust.git] / tests / compile-fail / fn_ptr_offset.rs
1 use std::mem;
2
3 fn f() {}
4
5 fn main() {
6     let x : fn() = f;
7     let y : *mut u8 = unsafe { mem::transmute(x) };
8     let y = y.wrapping_offset(1);
9     let x : fn() = unsafe { mem::transmute(y) };
10     x(); //~ ERROR: tried to use an integer pointer or a dangling pointer as a function pointer
11 }