The test is similar to <rdar://problem/
13239840> but doesn't actually test
the case that fails there. It's still a good test, though.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175715
91177308-0d34-0410-b5e6-
96231b3b80d8
f2(p);
}
}
+
+namespace rdar13249297 {
+ struct IntWrapperSubclass : public IntWrapper {};
+
+ struct IntWrapperWrapper {
+ IntWrapper w;
+ };
+
+ void test(IntWrapperWrapper *ww) {
+ reinterpret_cast<IntWrapperSubclass *>(ww)->x = 42;
+ clang_analyzer_eval(reinterpret_cast<IntWrapperSubclass *>(ww)->x == 42); // expected-warning{{TRUE}}
+
+ clang_analyzer_eval(ww->w.x == 42); // expected-warning{{TRUE}}
+ ww->w.x = 0;
+
+ clang_analyzer_eval(reinterpret_cast<IntWrapperSubclass *>(ww)->x == 42); // expected-warning{{FALSE}}
+ }
+}