Fixed #4387 (false positive 'constStatement' in 1.57)
This commit is contained in:
parent
ee435bf885
commit
5c7e1cf9ff
|
@ -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%")) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue