George Karpenkov | a393e68 | 2018-08-29 20:29:17 +0000 | [diff] [blame] | 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config c++-temp-dtor-inlining=false -verify -analyzer-config eagerly-assume=false %s |
| 2 | // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config c++-temp-dtor-inlining=true -DINLINE -verify -analyzer-config eagerly-assume=false %s |
Artem Dergachev | 661ab34 | 2018-02-15 19:17:44 +0000 | [diff] [blame] | 3 | |
| 4 | void clang_analyzer_eval(bool); |
| 5 | |
| 6 | struct S { |
| 7 | int &x; |
| 8 | |
| 9 | S(int &x) : x(x) { ++x; } |
| 10 | ~S() { --x; } |
| 11 | }; |
| 12 | |
| 13 | void foo() { |
| 14 | int x = 0; |
| 15 | S(x).x += 1; |
| 16 | clang_analyzer_eval(x == 1); |
| 17 | #ifdef INLINE |
| 18 | // expected-warning@-2{{TRUE}} |
| 19 | #else |
| 20 | // expected-warning@-4{{UNKNOWN}} |
| 21 | #endif |
| 22 | } |