Fixed #4387 (false positive 'constStatement' in 1.57)

This commit is contained in:
Daniel Marjamki 2013-02-23 16:26:25 +01:00
parent ee435bf885
commit 5c7e1cf9ff
2 changed files with 6 additions and 1 deletions

View File

@ -2253,7 +2253,8 @@ void CheckOther::checkIncompleteStatement()
else if (Token::simpleMatch(tok, "= {"))
tok = tok->next()->link();
else if (tok->str() == "{" && Token::Match(tok->tokAt(-2), "%type% %var%"))
// C++11 struct/array initialization in initializer list
else if (tok->str() == "{" && Token::Match(tok->tokAt(-2), ",|: %var%") && Token::Match(tok->link(), "} [,{]"))
tok = tok->link();
else if (Token::Match(tok, "[;{}] %str%") || Token::Match(tok, "[;{}] %num%")) {

View File

@ -176,6 +176,10 @@ private:
// #2482 - false positive for empty struct
check("struct A {};");
ASSERT_EQUALS("", errout.str());
// #4387 - C++11 initializer list
check("A::A() : abc{0} {}");
ASSERT_EQUALS("", errout.str());
}
void returnstruct() {