Jordan Rose | 9f6441a | 2012-08-15 17:33:34 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-ipa=inlining -verify %s |
| 2 | |
| 3 | void clang_analyzer_eval(bool); |
| 4 | |
| 5 | typedef struct Opaque *Data; |
| 6 | struct IntWrapper { |
| 7 | int x; |
| 8 | }; |
| 9 | |
| 10 | struct Child : public IntWrapper { |
| 11 | void set() { x = 42; } |
| 12 | }; |
| 13 | |
| 14 | void test(Data data) { |
| 15 | Child *wrapper = reinterpret_cast<Child*>(data); |
| 16 | // Don't crash when upcasting here. |
| 17 | // We don't actually know if 'data' is a Child. |
| 18 | wrapper->set(); |
| 19 | clang_analyzer_eval(wrapper->x == 42); // expected-warning{{TRUE}} |
| 20 | } |