Fixed #2695 (False positive: null pointer dereference and ternary operator (?:))
This commit is contained in:
parent
b31da161a7
commit
0a2f11c2cd
|
@ -444,8 +444,8 @@ void CheckNullPointer::nullPointerStructByDeRefAndChec()
|
|||
--indentlevel2;
|
||||
}
|
||||
|
||||
// label. goto destination..
|
||||
else if (tok2->isName() && Token::simpleMatch(tok2->next(), ":"))
|
||||
// label / ?:
|
||||
else if (tok2->str() == ":")
|
||||
break;
|
||||
|
||||
// Reassignment of the struct
|
||||
|
|
|
@ -493,6 +493,19 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int f(Item *item) {\n"
|
||||
" x = item ? ab(item->x) : 0;\n"
|
||||
" if (item) { }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int f(Item *item) {\n"
|
||||
" item->x = 0;\n"
|
||||
" a = b ? c : d;\n"
|
||||
" if (item) { }\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("error", "", errout.str());
|
||||
|
||||
check("BOOL GotoFlyAnchor()\n" // #2243
|
||||
"{\n"
|
||||
" const SwFrm* pFrm = GetCurrFrm();\n"
|
||||
|
|
Loading…
Reference in New Issue