2013-09-19 02:58:58 +08:00
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
|
|
|
|
|
|
|
|
bool PR14634(int x) {
|
|
|
|
double y = (double)x;
|
|
|
|
return !y;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool PR14634_implicit(int x) {
|
|
|
|
double y = (double)x;
|
|
|
|
return y;
|
|
|
|
}
|
2013-12-20 06:32:39 +08:00
|
|
|
|
|
|
|
void intAsBoolAsSwitchCondition(int c) {
|
2013-12-20 07:05:40 +08:00
|
|
|
switch ((bool)c) { // expected-warning {{switch condition has boolean value}}
|
2013-12-20 06:32:39 +08:00
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
}
|
2013-12-20 07:05:40 +08:00
|
|
|
|
|
|
|
switch ((int)(bool)c) { // no-warning
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
}
|
2013-12-20 06:32:39 +08:00
|
|
|
}
|