[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.

llvm-svn: 163746
This commit is contained in:
Jordan Rose 2012-09-12 21:50:56 +00:00
parent d44977ef64
commit 2010d437f9
1 changed files with 16 additions and 0 deletions

View File

@ -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}}
}
}