aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/statements.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-02-20 13:06:31 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-02-20 13:06:31 +0000
commitbca07a4524feb4edec581062d631a13116320a24 (patch)
treea9243275843fbeaa590afc07ee888e006b8d54ea /test/Sema/statements.c
parent998bc5802ecdd65ce3b270f6c69a8ae8557f0a10 (diff)
downloadsrc-bca07a4524feb4edec581062d631a13116320a24.tar.gz
src-bca07a4524feb4edec581062d631a13116320a24.zip
Notes
Diffstat (limited to 'test/Sema/statements.c')
-rw-r--r--test/Sema/statements.c51
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;
+}
+