diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2013-06-10 20:45:12 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2013-06-10 20:45:12 +0000 |
commit | 6a0372513edbc473b538d2f724efac50405d6fef (patch) | |
tree | 8f7776b7310bebaf415ac5b69e46e9f928c37144 /test/Analysis/temporaries.cpp | |
parent | 809500fc2c13c8173a16b052304d983864e4a1e1 (diff) |
Vendor import of clang tags/RELEASE_33/final r183502 (effectively, 3.3vendor/clang/clang-release_33-r183502
Notes
Notes:
svn path=/vendor/clang/dist/; revision=251609
svn path=/vendor/clang/clang-release_33-r183502/; revision=251610; tag=vendor/clang/clang-release_33-r183502
Diffstat (limited to 'test/Analysis/temporaries.cpp')
-rw-r--r-- | test/Analysis/temporaries.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/test/Analysis/temporaries.cpp b/test/Analysis/temporaries.cpp index 32a4d3bef465..efc0825470cd 100644 --- a/test/Analysis/temporaries.cpp +++ b/test/Analysis/temporaries.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify -w %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify -w -std=c++03 %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify -w -std=c++11 %s extern bool clang_analyzer_eval(bool); @@ -76,3 +77,35 @@ namespace rdar13281951 { } } +namespace compound_literals { + struct POD { + int x, y; + }; + struct HasCtor { + HasCtor(int x, int y) : x(x), y(y) {} + int x, y; + }; + struct HasDtor { + int x, y; + ~HasDtor(); + }; + struct HasCtorDtor { + HasCtorDtor(int x, int y) : x(x), y(y) {} + ~HasCtorDtor(); + int x, y; + }; + + void test() { + clang_analyzer_eval(((POD){1, 42}).y == 42); // expected-warning{{TRUE}} + clang_analyzer_eval(((HasDtor){1, 42}).y == 42); // expected-warning{{TRUE}} + +#if __cplusplus >= 201103L + clang_analyzer_eval(((HasCtor){1, 42}).y == 42); // expected-warning{{TRUE}} + + // FIXME: should be TRUE, but we don't inline the constructors of + // temporaries because we can't model their destructors yet. + clang_analyzer_eval(((HasCtorDtor){1, 42}).y == 42); // expected-warning{{UNKNOWN}} +#endif + } +} + |