Fixed #6260 - C++11 style array initialization
This commit is contained in:
parent
428587f3d4
commit
4163f1e122
|
@ -1699,7 +1699,7 @@ void CheckOther::checkIncompleteStatement()
|
||||||
tok = tok->next()->link();
|
tok = tok->next()->link();
|
||||||
|
|
||||||
// C++11 struct/array/etc initialization in initializer list
|
// 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();
|
tok = tok->link();
|
||||||
|
|
||||||
// C++11 vector initialization / return { .. }
|
// C++11 vector initialization / return { .. }
|
||||||
|
|
|
@ -185,6 +185,14 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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
|
// #2482 - false positive for empty struct
|
||||||
check("struct A {};");
|
check("struct A {};");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
Loading…
Reference in New Issue