OSDN Git Service

PR testsuite/20772
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / opt / switch4.C
1 // { dg-do compile }
2
3 // PR c++/20008
4
5 // We failed to compile this because CFG cleanup left the switch
6 // statement intact, whereas expand_case expected at least one
7 // in-range case to remain.
8
9 typedef enum _SECStatus {
10   SECWouldBlock = -2,
11   SECFailure = -1,
12   SECSuccess = 0
13 } SECStatus;
14
15 typedef enum {
16   SEC_ERROR_BAD_SIGNATURE = (-0x2000) + 10
17 } SECErrorCodes;
18
19 void g(void);
20 void f(SECStatus status)
21 {
22   switch( status )
23     {
24     case SEC_ERROR_BAD_SIGNATURE :
25       // This case can be optimized away in C++ (but apparently not in
26       // C), because the enum type is defined with a narrow range.
27       g();
28       break ;
29     }
30 }