With reinterpret_cast, we can get completely unrelated types in a region hierarchy together; this was resulting in CXXBaseObjectRegions being layered directly on an (untyped) SymbolicRegion, whose symbol was from a completely different type hierarchy. This was what was causing the internal buildbot to fail. Reverts r161911, which merely masked the problem. llvm-svn: 161960
21 lines
517 B
C++
21 lines
517 B
C++
// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-ipa=inlining -verify %s
|
|
|
|
void clang_analyzer_eval(bool);
|
|
|
|
typedef struct Opaque *Data;
|
|
struct IntWrapper {
|
|
int x;
|
|
};
|
|
|
|
struct Child : public IntWrapper {
|
|
void set() { x = 42; }
|
|
};
|
|
|
|
void test(Data data) {
|
|
Child *wrapper = reinterpret_cast<Child*>(data);
|
|
// Don't crash when upcasting here.
|
|
// We don't actually know if 'data' is a Child.
|
|
wrapper->set();
|
|
clang_analyzer_eval(wrapper->x == 42); // expected-warning{{TRUE}}
|
|
}
|