summaryrefslogtreecommitdiff
path: root/test/Analysis/casts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/casts.cpp')
-rw-r--r--test/Analysis/casts.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/Analysis/casts.cpp b/test/Analysis/casts.cpp
index 339539189ed7..53e1cd085acd 100644
--- a/test/Analysis/casts.cpp
+++ b/test/Analysis/casts.cpp
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
-// expected-no-diagnostics
bool PR14634(int x) {
double y = (double)x;
@@ -10,3 +9,15 @@ bool PR14634_implicit(int x) {
double y = (double)x;
return y;
}
+
+void intAsBoolAsSwitchCondition(int c) {
+ switch ((bool)c) { // expected-warning {{switch condition has boolean value}}
+ case 0:
+ break;
+ }
+
+ switch ((int)(bool)c) { // no-warning
+ case 0:
+ break;
+ }
+}