Add a warning to catch a bug recently caught by code review, like this:
t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise &
or remove constant [-Wlogical-bitwise-confusion]
return x && 4;
^ ~
wording improvement suggestions are welcome.
llvm-svn: 108260
diff --git a/clang/test/SemaCXX/switch.cpp b/clang/test/SemaCXX/switch.cpp
index fc13630..54240dc 100644
--- a/clang/test/SemaCXX/switch.cpp
+++ b/clang/test/SemaCXX/switch.cpp
@@ -8,7 +8,8 @@
}
int n = 3;
- switch (n && 1) { // expected-warning {{bool}}
+ switch (n && 1) { // expected-warning {{bool}} \
+ // expected-warning {{use of logical && with constant operand}}
case 1:
break;
}