Fixed #6260 - C++11 style array initialization

This commit is contained in:
PKEuS 2014-11-18 19:50:09 +01:00
parent 428587f3d4
commit 4163f1e122
2 changed files with 9 additions and 1 deletions

View File

@ -1699,7 +1699,7 @@ void CheckOther::checkIncompleteStatement()
tok = tok->next()->link();
// C++11 struct/array/etc initialization in initializer list
else if (Token::Match(tok->previous(), "%var% {") && !Token::findsimplematch(tok,";",tok->link()))
else if (Token::Match(tok->previous(), "%var%|] {") && !Token::findsimplematch(tok,";",tok->link()))
tok = tok->link();
// C++11 vector initialization / return { .. }

View File

@ -185,6 +185,14 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
// #6260 - C++11 array initialization
check("void foo() {\n"
" static const char* a[][2] {\n"
" {\"b\", \"\"},\n"
" };\n"
"}");
ASSERT_EQUALS("", errout.str());
// #2482 - false positive for empty struct
check("struct A {};");
ASSERT_EQUALS("", errout.str());