parent
d9b6940070
commit
b2852de456
|
@ -2268,20 +2268,30 @@ private:
|
|||
|
||||
void nullpointer72() { // #10215
|
||||
check("int test() {\n"
|
||||
"int* p0 = nullptr, *p1 = nullptr;\n"
|
||||
"getFoo(p0);\n"
|
||||
"getBar(p1);\n"
|
||||
"if (!(p0 != nullptr && p1 != nullptr))\n"
|
||||
"return {};\n"
|
||||
"return *p0 + *p1;\n"
|
||||
" int* p0 = nullptr, *p1 = nullptr;\n"
|
||||
" getFoo(p0);\n"
|
||||
" getBar(p1);\n"
|
||||
" if (!(p0 != nullptr && p1 != nullptr))\n"
|
||||
" return {};\n"
|
||||
" return *p0 + *p1;\n"
|
||||
"}\n", true /*inconclusive*/);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int test2() {\n"
|
||||
"int* p0 = nullptr; \n"
|
||||
"if (!(getBaz(p0) && p0 != nullptr))\n"
|
||||
"return 0;\n"
|
||||
"return *p0;\n"
|
||||
" int* p0 = nullptr;\n"
|
||||
" if (!(getBaz(p0) && p0 != nullptr))\n"
|
||||
" return 0;\n"
|
||||
" return *p0;\n"
|
||||
"}\n", true /*inconclusive*/);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int test3() {\n"
|
||||
" Obj* PObj = nullptr;\n"
|
||||
" if (!(GetObj(PObj) && PObj != nullptr))\n"
|
||||
" return 1;\n"
|
||||
" if (!PObj->foo())\n"
|
||||
" test();\n"
|
||||
" PObj->bar();\n"
|
||||
"}\n", true /*inconclusive*/);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue