1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-store=region -verify %s 2 3 bool PR14634(int x) { 4 double y = (double)x; 5 return !y; 6 } 7 8 bool PR14634_implicit(int x) { 9 double y = (double)x; 10 return y; 11 } 12 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 25 int *&castToIntPtrLValueRef(char *p) { 26 return (int *&)*(int *)p; 27 } 28 bool testCastToIntPtrLValueRef(char *p, int *s) { 29 return castToIntPtrLValueRef(p) != s; // no-crash 30 } 31 32 int *&&castToIntPtrRValueRef(char *p) { 33 return (int *&&)*(int *)p; 34 } 35 bool testCastToIntPtrRValueRef(char *p, int *s) { 36 return castToIntPtrRValueRef(p) != s; // no-crash 37 } 38