Fixed #1137 (false positive: uninitialized variable when using a class object)
This commit is contained in:
parent
5a89cc3259
commit
ef21ba7425
|
@ -1339,7 +1339,7 @@ private:
|
||||||
const bool p(vartok->str() == "*");
|
const bool p(vartok->str() == "*");
|
||||||
if (p)
|
if (p)
|
||||||
vartok = vartok->next();
|
vartok = vartok->next();
|
||||||
if (vartok->varId() != 0)
|
if ((p || tok.isStandardType()) && vartok->varId() != 0)
|
||||||
checks.push_back(new CheckUninitVar(owner, vartok->varId(), vartok->str(), p, false));
|
checks.push_back(new CheckUninitVar(owner, vartok->varId(), vartok->str(), p, false));
|
||||||
return vartok->next();
|
return vartok->next();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1006,6 +1006,13 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("static void foo()\n"
|
||||||
|
"{\n"
|
||||||
|
" Foo p;\n"
|
||||||
|
" int x = p.abcd();\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
checkUninitVar("A a()\n"
|
checkUninitVar("A a()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" A ret;\n"
|
" A ret;\n"
|
||||||
|
|
Loading…
Reference in New Issue