diff options
Diffstat (limited to 'src/test/ui/consts/const-cast.rs')
-rw-r--r-- | src/test/ui/consts/const-cast.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/consts/const-cast.rs b/src/test/ui/consts/const-cast.rs new file mode 100644 index 000000000..abeb24121 --- /dev/null +++ b/src/test/ui/consts/const-cast.rs @@ -0,0 +1,16 @@ +// run-pass +#![allow(non_upper_case_globals)] + +struct TestStruct { + x: *const u8, +} + +unsafe impl Sync for TestStruct {} + +extern "C" fn foo() {} +const x: extern "C" fn() = foo; +static y: TestStruct = TestStruct { x: x as *const u8 }; + +pub fn main() { + assert_eq!(x as *const u8, y.x); +} |