diff options
-rw-r--r-- | test/Analysis/reinterpret-cast.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Analysis/reinterpret-cast.cpp b/test/Analysis/reinterpret-cast.cpp index aaa600e4b9..d1aed80a0c 100644 --- a/test/Analysis/reinterpret-cast.cpp +++ b/test/Analysis/reinterpret-cast.cpp @@ -46,3 +46,21 @@ namespace PR14872 { f2(p); } } + +namespace rdar13249297 { + struct IntWrapperSubclass : public IntWrapper {}; + + struct IntWrapperWrapper { + IntWrapper w; + }; + + void test(IntWrapperWrapper *ww) { + reinterpret_cast<IntWrapperSubclass *>(ww)->x = 42; + clang_analyzer_eval(reinterpret_cast<IntWrapperSubclass *>(ww)->x == 42); // expected-warning{{TRUE}} + + clang_analyzer_eval(ww->w.x == 42); // expected-warning{{TRUE}} + ww->w.x = 0; + + clang_analyzer_eval(reinterpret_cast<IntWrapperSubclass *>(ww)->x == 42); // expected-warning{{FALSE}} + } +} |