1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s 2 3 int x = 1; 4 5 struct { 6 int a, b; 7 } s = {2, 3}; 8 9 int arr[] = {4, 5, 6}; 10 11 void clang_analyzer_eval(int); 12 main()13int main() { 14 // Do not trust global initializers in C++. 15 clang_analyzer_eval(x == 1); // expected-warning{{TRUE}} // expected-warning{{FALSE}} 16 clang_analyzer_eval(s.a == 2); // expected-warning{{TRUE}} // expected-warning{{FALSE}} 17 clang_analyzer_eval(s.b == 3); // expected-warning{{TRUE}} // expected-warning{{FALSE}} 18 clang_analyzer_eval(arr[0] == 4); // expected-warning{{TRUE}} // expected-warning{{FALSE}} 19 clang_analyzer_eval(arr[1] == 5); // expected-warning{{TRUE}} // expected-warning{{FALSE}} 20 clang_analyzer_eval(arr[2] == 6); // expected-warning{{TRUE}} // expected-warning{{FALSE}} 21 return 0; 22 } 23