diff options
Diffstat (limited to 'test/Sema/statements.c')
-rw-r--r-- | test/Sema/statements.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/test/Sema/statements.c b/test/Sema/statements.c index e3c41f3e1aaf..963b98fe56ad 100644 --- a/test/Sema/statements.c +++ b/test/Sema/statements.c @@ -50,4 +50,53 @@ int test12(enum Numbers num) { case kThree: break; } -}
\ No newline at end of file +} + + +enum x { a, b, c, d, e, f, g }; + +void foo(enum x X) { + switch (X) { // expected-warning {{enumeration value 'g' not handled in switch}} + case a: + case b: + case c: + case d: + case e: + case f: + break; + } + + switch (X) { // expected-warning {{enumeration values 'f' and 'g' not handled in switch}} + case a: + case b: + case c: + case d: + case e: + break; + } + + switch (X) { // expected-warning {{enumeration values 'e', 'f', and 'g' not handled in switch}} + case a: + case b: + case c: + case d: + break; + } + + switch (X) { // expected-warning {{5 enumeration values not handled in switch: 'c', 'd', 'e'...}} + case a: + case b: + break; + } +} + +// PR 8880 +// FIXME: Clang should reject this, since GCC does. Previously this +// was causing a crash in the CFG builder. +int test_pr8880() { + int first = 1; + for ( ; ({ if (first) { first = 0; continue; } 0; }); ) + return 0; + return 1; +} + |