Incomplete statement: tweaked bailout for '(void*)0' using isCasted()

This commit is contained in:
Daniel Marjamäki 2014-12-23 18:19:33 +01:00
parent 1b2a23b3fe
commit de1a91f30d
2 changed files with 3 additions and 3 deletions

View File

@ -1733,8 +1733,8 @@ void CheckOther::checkIncompleteStatement()
if (Token::Match(tok->next(), "%num% [,.]")) if (Token::Match(tok->next(), "%num% [,.]"))
continue; continue;
// No warning for [;{}] 0 ; // No warning for [;{}] (void *) 0 ;
if (Token::Match(tok, "[;{}] 0 ;")) if (Token::Match(tok, "[;{}] 0 ;") && tok->next()->isCasted())
continue; continue;
// bailout if there is a "? :" in this statement // bailout if there is a "? :" in this statement

View File

@ -152,7 +152,7 @@ private:
} }
void void0() { // #6327 void void0() { // #6327
check("void f() { 0; }"); check("void f() { (void*)0; }");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }