24 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s2// expected-no-diagnostics3class B {4public:5 bool m;6 ~B() {} // The destructor ensures that the binary logical operator below is wrapped in the ExprWithCleanups.7};8B foo();9int getBool();10int *getPtr();11int test() {12 int r = 0;13 for (int x = 0; x< 10; x++) {14 int *p = getPtr();15 // Liveness info is not computed correctly due to the following expression.16 // This happens due to CFG being special cased for short circuit operators.17 // PR1815918 if (p != 0 && getBool() && foo().m && getBool()) {19 r = *p; // no warning20 }21 }22 return r;23}24