diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-09-12 21:50:56 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-09-12 21:50:56 +0000 |
commit | 3225d072a348658cb67c45cdb46a981b09d1f562 (patch) | |
tree | 67ca5cb3d95ddf3984e8133a13e93992228873ff | |
parent | d66b3c56a5da1cbaf5ec12811ee7221231b6c301 (diff) |
[analyzer] Re-add reinterpret_cast virtual call test case from r163644.
We mostly just don't want to crash analyzing this test case; it's likely
the code found here will actually crash if compiled and run.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163746 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Analysis/inlining/dyn-dispatch-bifurcate.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp b/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp index fa473aebce..37713481a4 100644 --- a/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp +++ b/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp @@ -15,3 +15,19 @@ void testKnown() { A a; clang_analyzer_eval(a.get() == 0); // expected-warning{{TRUE}} } + + +namespace ReinterpretDisruptsDynamicTypeInfo { + class Parent {}; + + class Child : public Parent { + public: + virtual int foo() { return 42; } + }; + + void test(Parent *a) { + Child *b = reinterpret_cast<Child *>(a); + if (!b) return; + clang_analyzer_eval(b->foo() == 42); // expected-warning{{UNKNOWN}} + } +} |