summaryrefslogtreecommitdiffstats
path: root/test/Analysis/initializer.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-04-08 18:45:10 +0000
committerdim <dim@FreeBSD.org>2013-04-08 18:45:10 +0000
commitc72c57c9e9b69944e3e009cd5e209634839581d3 (patch)
tree4fc2f184c499d106f29a386c452b49e5197bf63d /test/Analysis/initializer.cpp
parent5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff)
downloadFreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip
FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'test/Analysis/initializer.cpp')
-rw-r--r--test/Analysis/initializer.cpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/test/Analysis/initializer.cpp b/test/Analysis/initializer.cpp
index 92d581b..3f7802c 100644
--- a/test/Analysis/initializer.cpp
+++ b/test/Analysis/initializer.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-ipa=inlining -analyzer-config c++-inlining=constructors -std=c++11 -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-config c++-inlining=constructors -std=c++11 -verify %s
void clang_analyzer_eval(bool);
@@ -68,8 +68,7 @@ void testReferenceMember() {
void testReferenceMember2() {
int *p = 0;
- // FIXME: We should warn here, since we're creating the reference here.
- RefWrapper X(*p); // expected-warning@-12 {{Dereference of null pointer}}
+ RefWrapper X(*p); // expected-warning {{Forming reference to null pointer}}
}
@@ -80,3 +79,33 @@ class StringWrapper {
public:
StringWrapper(const char *input) : str(strdup(input)) {} // no-warning
};
+
+
+// PR15070 - Constructing a type containing a non-POD array mistakenly
+// tried to perform a bind instead of relying on the CXXConstructExpr,
+// which caused a cast<> failure in RegionStore.
+namespace DefaultConstructorWithCleanups {
+ class Element {
+ public:
+ int value;
+
+ class Helper {
+ public:
+ ~Helper();
+ };
+ Element(Helper h = Helper());
+ };
+ class Wrapper {
+ public:
+ Element arr[2];
+
+ Wrapper();
+ };
+
+ Wrapper::Wrapper() /* initializers synthesized */ {}
+
+ int test() {
+ Wrapper w;
+ return w.arr[0].value; // no-warning
+ }
+}
OpenPOWER on IntegriCloud