2018-08-30 07:18:55 -05:00
|
|
|
//@ run-pass
|
2018-08-31 08:02:01 -05:00
|
|
|
#![allow(overflowing_literals)]
|
|
|
|
|
2015-12-16 11:44:15 -06:00
|
|
|
fn main() {
|
|
|
|
#[cfg(target_pointer_width = "32")]
|
|
|
|
const I: isize = -2147483648isize;
|
|
|
|
#[cfg(target_pointer_width = "64")]
|
|
|
|
const I: isize = -9223372036854775808isize;
|
2020-10-24 18:21:40 -05:00
|
|
|
assert_eq!(i32::MIN as u64, 0xffffffff80000000);
|
2015-12-16 11:44:15 -06:00
|
|
|
assert_eq!(-2147483648isize as u64, 0xffffffff80000000);
|
2018-02-21 15:02:52 -06:00
|
|
|
assert_eq!(-2147483648i32 as u64, 0xffffffff80000000);
|
2020-10-24 18:21:40 -05:00
|
|
|
assert_eq!(i64::MIN as u64, 0x8000000000000000);
|
2016-03-09 12:27:36 -06:00
|
|
|
#[cfg(target_pointer_width = "64")]
|
2015-12-16 11:44:15 -06:00
|
|
|
assert_eq!(-9223372036854775808isize as u64, 0x8000000000000000);
|
2016-03-09 12:27:36 -06:00
|
|
|
#[cfg(target_pointer_width = "32")]
|
|
|
|
assert_eq!(-9223372036854775808isize as u64, 0);
|
2018-02-21 15:02:52 -06:00
|
|
|
assert_eq!(-9223372036854775808i32 as u64, 0);
|
2020-10-24 18:21:40 -05:00
|
|
|
const J: usize = i32::MAX as usize;
|
2015-12-16 11:44:15 -06:00
|
|
|
const K: usize = -1i32 as u32 as usize;
|
2020-10-24 18:21:40 -05:00
|
|
|
const L: usize = i32::MIN as usize;
|
|
|
|
const M: usize = i64::MIN as usize;
|
2015-12-16 11:44:15 -06:00
|
|
|
match 5 {
|
|
|
|
J => {},
|
|
|
|
K => {},
|
|
|
|
L => {},
|
|
|
|
M => {},
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
match 5 {
|
|
|
|
I => {},
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|