xref: /minix3/external/bsd/llvm/dist/clang/test/Analysis/casts.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1 // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
2 
PR14634(int x)3 bool PR14634(int x) {
4   double y = (double)x;
5   return !y;
6 }
7 
PR14634_implicit(int x)8 bool PR14634_implicit(int x) {
9   double y = (double)x;
10   return y;
11 }
12 
intAsBoolAsSwitchCondition(int c)13 void intAsBoolAsSwitchCondition(int c) {
14   switch ((bool)c) { // expected-warning {{switch condition has boolean value}}
15   case 0:
16     break;
17   }
18 
19   switch ((int)(bool)c) { // no-warning
20     case 0:
21       break;
22   }
23 }
24