1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config ipa=dynamic-bifurcate -verify -Wno-reinterpret-base-class %s 2f4a2713aSLionel Sambuc 3f4a2713aSLionel Sambuc void clang_analyzer_eval(bool); 4f4a2713aSLionel Sambuc 5f4a2713aSLionel Sambuc class A { 6f4a2713aSLionel Sambuc public: get()7f4a2713aSLionel Sambuc virtual int get() { return 0; } 8f4a2713aSLionel Sambuc }; 9f4a2713aSLionel Sambuc testBifurcation(A * a)10f4a2713aSLionel Sambucvoid testBifurcation(A *a) { 11f4a2713aSLionel Sambuc clang_analyzer_eval(a->get() == 0); // expected-warning{{TRUE}} expected-warning{{UNKNOWN}} 12f4a2713aSLionel Sambuc } 13f4a2713aSLionel Sambuc testKnown()14f4a2713aSLionel Sambucvoid testKnown() { 15f4a2713aSLionel Sambuc A a; 16f4a2713aSLionel Sambuc clang_analyzer_eval(a.get() == 0); // expected-warning{{TRUE}} 17f4a2713aSLionel Sambuc } 18f4a2713aSLionel Sambuc testNew()19f4a2713aSLionel Sambucvoid testNew() { 20f4a2713aSLionel Sambuc A *a = new A(); 21f4a2713aSLionel Sambuc clang_analyzer_eval(a->get() == 0); // expected-warning{{TRUE}} 22f4a2713aSLionel Sambuc } 23f4a2713aSLionel Sambuc 24f4a2713aSLionel Sambuc 25f4a2713aSLionel Sambuc namespace ReinterpretDisruptsDynamicTypeInfo { 26f4a2713aSLionel Sambuc class Parent {}; 27f4a2713aSLionel Sambuc 28f4a2713aSLionel Sambuc class Child : public Parent { 29f4a2713aSLionel Sambuc public: foo()30f4a2713aSLionel Sambuc virtual int foo() { return 42; } 31f4a2713aSLionel Sambuc }; 32f4a2713aSLionel Sambuc test(Parent * a)33f4a2713aSLionel Sambuc void test(Parent *a) { 34f4a2713aSLionel Sambuc Child *b = reinterpret_cast<Child *>(a); 35f4a2713aSLionel Sambuc if (!b) return; 36f4a2713aSLionel Sambuc clang_analyzer_eval(b->foo() == 42); // expected-warning{{UNKNOWN}} 37f4a2713aSLionel Sambuc } 38f4a2713aSLionel Sambuc } 39