diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wswitch-enum-2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/Wswitch-enum-2.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wswitch-enum-2.c b/gcc/testsuite/gcc.dg/Wswitch-enum-2.c new file mode 100644 index 000000000..6b5ca1d30 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wswitch-enum-2.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wswitch-enum" } */ + +typedef enum { a = 2 } T; + +int main() +{ + T x = a; + switch(x) + { + case a ... 3: /* { dg-warning "case value '3' not in enumerated" "3" } */ + break; + } + switch(x) + { + case 1 ... a: /* { dg-warning "case value '1' not in enumerated" "1" } */ + break; + } + return 0; +} + |