blob: 73f2e2de7381e8703fac2ce088e1d92158dda328 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// 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}}
}
|