1 // run-pass
2 #![allow(non_upper_case_globals)]
3 
4 enum A { A1, A2 }
5 enum B { B1=4, B2=2 }
6 
main()7 pub fn main () {
8     static c1: isize = A::A2 as isize;
9     static c2: isize = B::B2 as isize;
10     let a1 = A::A2 as isize;
11     let a2 = B::B2 as isize;
12     assert_eq!(c1, 1);
13     assert_eq!(c2, 2);
14     assert_eq!(a1, 1);
15     assert_eq!(a2, 2);
16 
17     // Turns out that adding a let-binding generates totally different MIR.
18     static c1_2: isize = { let v = A::A1; v as isize };
19     static c2_2: isize = { let v = B::B1; v as isize };
20     let a1_2 = { let v = A::A1; v as isize };
21     let a2_2 = { let v = B::B1; v as isize };
22     assert_eq!(c1_2, 0);
23     assert_eq!(c2_2, 4);
24     assert_eq!(a1_2, 0);
25     assert_eq!(a2_2, 4);
26 }
27