isPointerDeref: Return false for function declarations
This commit is contained in:
parent
aee9519d21
commit
36f369473e
|
@ -166,6 +166,9 @@ bool CheckNullPointer::isPointerDeRef(const Token *tok, bool &unknown, const Set
|
|||
}
|
||||
}
|
||||
|
||||
if (tok->str() == "(" && !tok->scope()->isExecutable())
|
||||
return false;
|
||||
|
||||
const Token* parent = tok->astParent();
|
||||
if (!parent)
|
||||
return false;
|
||||
|
|
|
@ -116,6 +116,7 @@ private:
|
|||
TEST_CASE(ticket6505);
|
||||
TEST_CASE(subtract);
|
||||
TEST_CASE(addNull);
|
||||
TEST_CASE(isPointerDeRefFunctionDecl);
|
||||
|
||||
TEST_CASE(ctu);
|
||||
}
|
||||
|
@ -3053,6 +3054,11 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void isPointerDeRefFunctionDecl() {
|
||||
check("const char** get() { return 0; }");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void ctu(const char code[]) {
|
||||
// Clear the error buffer..
|
||||
errout.str("");
|
||||
|
|
Loading…
Reference in New Issue