about summary refs log tree commit diff
path: root/src/test/run-pass/consts/const-enum-cast.rs
blob: 3b140d147579bddc2aa4fc30ad11804bc0c5be9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// run-pass
#![allow(dead_code)]
#![allow(non_upper_case_globals)]

enum A { A1, A2 }
enum B { B1=0, B2=2 }

pub fn main () {
    static c1: isize = A::A2 as isize;
    static c2: isize = B::B2 as isize;
    let a1 = A::A2 as isize;
    let a2 = B::B2 as isize;
    assert_eq!(c1, 1);
    assert_eq!(c2, 2);
    assert_eq!(a1, 1);
    assert_eq!(a2, 2);
}