Fixed #6264 (FP: gimp: struct initialized via pointers to member variables)
This commit is contained in:
parent
9757f5b5f4
commit
5f68f3ddf6
|
@ -676,6 +676,8 @@ bool CheckUninitVar::checkIfForWhileHead(const Token *startparentheses, const Va
|
|||
for (const Token *tok = startparentheses->next(); tok && tok != endpar; tok = tok->next()) {
|
||||
if (tok->varId() == var.declarationId()) {
|
||||
if (Token::Match(tok, "%name% . %name%")) {
|
||||
if (membervar.empty())
|
||||
return true;
|
||||
if (tok->strAt(2) == membervar) {
|
||||
if (isMemberVariableAssignment(tok, membervar))
|
||||
return true;
|
||||
|
|
|
@ -844,6 +844,13 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar("void f() {\n"
|
||||
" C c;\n"
|
||||
" if (fun(&c.d));\n"
|
||||
" return c;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar("void f() {\n"
|
||||
" char a[10];\n"
|
||||
" if (a[0] = x){}\n"
|
||||
|
|
Loading…
Reference in New Issue