| 1 |
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection \ |
| 2 |
// RUN: -verify %s |
| 3 |
|
| 4 |
#define nil ((id)0) |
| 5 |
|
| 6 |
void clang_analyzer_eval(int); |
| 7 |
|
| 8 |
struct S { |
| 9 |
int x; |
| 10 |
S(); |
| 11 |
}; |
| 12 |
|
| 13 |
@interface I |
| 14 |
@property S s; |
| 15 |
@end |
| 16 |
|
| 17 |
void foo() { |
| 18 |
// This produces a zero-initialized structure. |
| 19 |
// FIXME: This very fact does deserve the warning, because zero-initialized |
| 20 |
// structures aren't always valid in C++. It's particularly bad when the |
| 21 |
// object has a vtable. |
| 22 |
S s = ((I *)nil).s; |
| 23 |
clang_analyzer_eval(s.x == 0); // expected-warning{{TRUE}} |
| 24 |
} |