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