• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection \
2// RUN:                    -verify %s
3
4#define nil ((id)0)
5
6void clang_analyzer_eval(int);
7
8struct S {
9  int x;
10  S();
11};
12
13@interface I
14@property S s;
15@end
16
17void 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}
25