teak-llvm/clang/test/Analysis/reinterpret-cast.cpp
Anna Zaks 6bab4ef4e8 [analyzer] Replace "-analyzer-ipa" with "-analyzer-config ipa".
The idea is to eventually place all analyzer options under
"analyzer-config". In addition, this lays the ground for introduction of
a high-level analyzer mode option, which will influence the
default setting for IPAMode.

llvm-svn: 173385
2013-01-24 23:15:30 +00:00

21 lines
494 B
C++

// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -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}}
}