Fixed #2284 (False positive: Possible null pointer reference)

This commit is contained in:
Daniel Marjamäki 2010-12-09 18:17:56 +01:00
parent 4d2c210f2a
commit ee083cd7a0
2 changed files with 9 additions and 0 deletions

View File

@ -742,6 +742,9 @@ private:
dereference(checks, *it);
}
else if (Token::simpleMatch(&tok, "( 0 &&"))
return tok.link();
if (tok.varId() != 0)
{
bool unknown = false;

View File

@ -513,6 +513,12 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
check("void f() {\n"
" Foo *p = 0;\n"
" bool b = (p && (p->type() == 1));\n"
"}\n");
ASSERT_EQUALS("", errout.str());
check("void foo()\n"
"{\n"
" int sz = sizeof((*(struct dummy *)0).x);\n"