2014-06-13 13:14:04 -05:00
|
|
|
// Tests that enum-to-float casts are disallowed.
|
2014-06-09 22:39:20 -05:00
|
|
|
|
|
|
|
enum E {
|
|
|
|
L0 = -1,
|
|
|
|
H0 = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
enum F {
|
|
|
|
L1 = 1,
|
|
|
|
H1 = 0xFFFFFFFFFFFFFFFF
|
|
|
|
}
|
|
|
|
|
2015-07-26 19:31:38 -05:00
|
|
|
static C0: f32 = E::L0 as f32; //~ ERROR casting
|
|
|
|
static C1: f32 = F::H1 as f32; //~ ERROR casting
|
2014-06-09 22:39:20 -05:00
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
let b = C0;
|
|
|
|
let d = C1;
|
|
|
|
assert_eq!(b, -1.0f32);
|
|
|
|
assert_eq!(d, -1.0f32);
|
|
|
|
}
|