@@ -112,7 +112,8 @@ class TestNullPointer : public TestFixture {
112112 TEST_CASE (nullpointer69); // #8143
113113 TEST_CASE (nullpointer70);
114114 TEST_CASE (nullpointer71); // #10178
115- TEST_CASE (nullpointer72); // #10321
115+ TEST_CASE (nullpointer72); // #10215
116+ TEST_CASE (nullpointer73); // #10321
116117 TEST_CASE (nullpointer_addressOf); // address of
117118 TEST_CASE (nullpointerSwitch); // #2626
118119 TEST_CASE (nullpointer_cast); // #4692
@@ -2240,7 +2241,27 @@ class TestNullPointer : public TestFixture {
22402241 ASSERT_EQUALS (" " , errout.str ());
22412242 }
22422243
2243- void nullpointer72 () {
2244+ void nullpointer72 () { // #10215
2245+ check (" int test() {\n "
2246+ " int* p0 = nullptr, *p1 = nullptr;\n "
2247+ " getFoo(p0);\n "
2248+ " getBar(p1);\n "
2249+ " if (!(p0 != nullptr && p1 != nullptr))\n "
2250+ " return {};\n "
2251+ " return *p0 + *p1;\n "
2252+ " }\n " , true /* inconclusive*/ );
2253+ ASSERT_EQUALS (" " , errout.str ());
2254+
2255+ check (" int test2() {\n "
2256+ " int* p0 = nullptr; \n "
2257+ " if (!(getBaz(p0) && p0 != nullptr))\n "
2258+ " return 0;\n "
2259+ " return *p0;\n "
2260+ " }\n " , true /* inconclusive*/ );
2261+ ASSERT_EQUALS (" " , errout.str ());
2262+ }
2263+
2264+ void nullpointer73 () {
22442265 check (" void f(bool flag2, int* ptr) {\n "
22452266 " bool flag1 = true;\n "
22462267 " if (flag2) {\n "
0 commit comments