summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/new.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/new.cpp')
-rw-r--r--clang/test/Analysis/new.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Analysis/new.cpp b/clang/test/Analysis/new.cpp
new file mode 100644
index 00000000000..95bd966cb02
--- /dev/null
+++ b/clang/test/Analysis/new.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -verify %s
+
+void f1() {
+ int *n1 = new int;
+ if (*n1) { // expected-warning {{Branch condition evaluates to a garbage value}}
+ }
+
+ int *n2 = new int(3);
+ if (*n2) { // no-warning
+ }
+}
+
OpenPOWER on IntegriCloud