Support C++11 array initialization in CheckUninitVar (#7010)
This commit is contained in:
parent
0825c57c9f
commit
e989d4b11b
|
@ -78,7 +78,7 @@ void CheckUninitVar::checkScope(const Scope* scope)
|
|||
tok = tok->next();
|
||||
while (Token::simpleMatch(tok->link(), "] ["))
|
||||
tok = tok->link()->next();
|
||||
if (Token::simpleMatch(tok->link(), "] ="))
|
||||
if (Token::Match(tok->link(), "] =|{"))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ private:
|
|||
TEST_CASE(uninitvar_operator); // #6680
|
||||
TEST_CASE(uninitvar_ternaryexpression); // #4683
|
||||
TEST_CASE(uninitvar_pointertoarray);
|
||||
TEST_CASE(uninitvar_cpp11ArrayInit); // #7010
|
||||
TEST_CASE(trac_4871);
|
||||
|
||||
TEST_CASE(syntax_error); // Ticket #5073
|
||||
|
@ -1480,6 +1481,14 @@ private:
|
|||
errout.str());
|
||||
}
|
||||
|
||||
void uninitvar_cpp11ArrayInit() { // #7010
|
||||
checkUninitVar("double foo(bool flag) {\n"
|
||||
" double adIHPoint_local[4][4]{};\n"
|
||||
" function(*adIHPoint_local);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
// alloc..
|
||||
void uninitvar_alloc() {
|
||||
checkUninitVar("void f() {\n"
|
||||
|
|
Loading…
Reference in New Issue