brintos

brintos / llvm-project-archived public Read only

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