2018-08-30 07:18:55 -05:00
|
|
|
//@ run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(dead_code)]
|
2015-10-03 10:42:22 -05:00
|
|
|
// A quick test of 'unsafe const fn' functionality
|
|
|
|
|
2015-10-24 03:52:07 -05:00
|
|
|
const unsafe fn dummy(v: u32) -> u32 {
|
2015-10-03 10:42:22 -05:00
|
|
|
!v
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Type;
|
|
|
|
impl Type {
|
2015-10-24 03:52:07 -05:00
|
|
|
const unsafe fn new() -> Type {
|
2015-10-03 10:42:22 -05:00
|
|
|
Type
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const VAL: u32 = unsafe { dummy(0xFFFF) };
|
|
|
|
const TYPE_INST: Type = unsafe { Type::new() };
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(VAL, 0xFFFF0000);
|
|
|
|
}
|