diff options
Diffstat (limited to 'test/Analysis/temp-obj-dtors-option.cpp')
-rw-r--r-- | test/Analysis/temp-obj-dtors-option.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Analysis/temp-obj-dtors-option.cpp b/test/Analysis/temp-obj-dtors-option.cpp new file mode 100644 index 0000000000000..25cc86ebde435 --- /dev/null +++ b/test/Analysis/temp-obj-dtors-option.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config c++-temp-dtor-inlining=false -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config c++-temp-dtor-inlining=true -DINLINE -verify %s + +void clang_analyzer_eval(bool); + +struct S { + int &x; + + S(int &x) : x(x) { ++x; } + ~S() { --x; } +}; + +void foo() { + int x = 0; + S(x).x += 1; + clang_analyzer_eval(x == 1); +#ifdef INLINE + // expected-warning@-2{{TRUE}} +#else + // expected-warning@-4{{UNKNOWN}} +#endif +} |