summaryrefslogtreecommitdiff
path: root/clang/test/Analysis/base-init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/base-init.cpp')
-rw-r--r--clang/test/Analysis/base-init.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/Analysis/base-init.cpp b/clang/test/Analysis/base-init.cpp
new file mode 100644
index 0000000..8fd7abc
--- /dev/null
+++ b/clang/test/Analysis/base-init.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store region -analyzer-inline-call -cfg-add-initializers -verify %s
+// XFAIL: *
+
+class A {
+ int x;
+public:
+ A();
+ int getx() const {
+ return x;
+ }
+};
+
+A::A() : x(0) {
+}
+
+class B : public A {
+ int y;
+public:
+ B();
+};
+
+B::B() {
+}
+
+void f() {
+ B b;
+ if (b.getx() != 0) {
+ int *p = 0;
+ *p = 0; // no-warning
+ }
+}