summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/enum_base_warn.C
blob: 4b14cf65e0939cada6bebc91ad061b0a87db833f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// { dg-do run }
// { dg-options "-O2 -Wtype-limits -std=c++0x" }
extern void link_error (void);

enum Alpha : unsigned char {
 ZERO = 0, ONE, TWO, THREE
};

Alpha a2;

int m1 = -1;
int GetM1() {
 return m1;
}

int main() {
 a2 = static_cast<Alpha>(GetM1());
 if (a2 == -1) {	// { dg-warning "always false due" }
    link_error ();
 }
 if (-1 == a2) {	// { dg-warning "always false due" }
    link_error ();
 }
 return 0;
}