gcc/testsuite/gcc.dg/Wswitch-enum-2.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -Wswitch-enum" } */ |
| 3 | |
| 4 | typedef enum { a = 2 } T; |
| 5 | |
| 6 | int main() |
| 7 | { |
| 8 | T x = a; |
| 9 | switch(x) |
| 10 | { |
| 11 | case a ... 3: /* { dg-warning "case value '3' not in enumerated" "3" } */ |
| 12 | break; |
| 13 | } |
| 14 | switch(x) |
| 15 | { |
| 16 | case 1 ... a: /* { dg-warning "case value '1' not in enumerated" "1" } */ |
| 17 | break; |
| 18 | } |
| 19 | return 0; |
| 20 | } |
| 21 |