From: Jordan Rose Date: Wed, 12 Sep 2012 21:50:56 +0000 (+0000) Subject: [analyzer] Re-add reinterpret_cast virtual call test case from r163644. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3225d072a348658cb67c45cdb46a981b09d1f562;p=clang [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 --- 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(a); + if (!b) return; + clang_analyzer_eval(b->foo() == 42); // expected-warning{{UNKNOWN}} + } +}