summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/statements.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-16 23:34:13 +0000
committerChris Lattner <sabre@nondot.org>2010-04-16 23:34:13 +0000
commit4ebae65d6af71115de86273e6b27f67e2cde2be7 (patch)
tree84105e5478d10fd5cf0edf6c0fcc62ad210ea0fa /clang/test/Sema/statements.c
parent12563b34957924ed46ff203bfc9b87a8b6eadf6d (diff)
downloadbcm5719-llvm-4ebae65d6af71115de86273e6b27f67e2cde2be7.tar.gz
bcm5719-llvm-4ebae65d6af71115de86273e6b27f67e2cde2be7.zip
make our existing "switch on bool" warning work for C. Since
the result of comparisons are 'int' in C, it doesn't work to test just the result type of the expression. llvm-svn: 101576
Diffstat (limited to 'clang/test/Sema/statements.c')
-rw-r--r--clang/test/Sema/statements.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/Sema/statements.c b/clang/test/Sema/statements.c
index 52b9c7543d4..e3c41f3e1aa 100644
--- a/clang/test/Sema/statements.c
+++ b/clang/test/Sema/statements.c
@@ -41,3 +41,13 @@ void test11(int bit) {
{
}
}
+
+// rdar://3271964
+enum Numbers { kOne, kTwo, kThree, kFour};
+int test12(enum Numbers num) {
+ switch (num == kOne) {// expected-warning {{switch condition has boolean value}}
+ default:
+ case kThree:
+ break;
+ }
+} \ No newline at end of file
OpenPOWER on IntegriCloud