Uninitialized variable: Fixed test failure. Ticket: #3369
This commit is contained in:
parent
f797307edc
commit
167530bf60
|
@ -1132,7 +1132,7 @@ bool CheckUninitVar::checkScopeForVariable(const Token *tok, const unsigned int
|
|||
if (Token::Match(tok, "return|break|continue|throw"))
|
||||
ret = true;
|
||||
else if (ret && tok->str() == ";")
|
||||
return false;
|
||||
return true;
|
||||
|
||||
// variable is seen..
|
||||
if (tok->varId() == varid) {
|
||||
|
|
|
@ -1774,6 +1774,14 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar2("void f() {\n"
|
||||
" int x;\n"
|
||||
" return;\n"
|
||||
"err:\n"
|
||||
" return x;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// for, while
|
||||
checkUninitVar2("void f() {\n"
|
||||
" int x;\n"
|
||||
|
|
Loading…
Reference in New Issue