Fixed #3058 (False positive: Uninitialized variable: data)
This commit is contained in:
parent
7cb5c97e7d
commit
c7886ca1c4
|
@ -510,6 +510,10 @@ private:
|
|||
// Used..
|
||||
if (Token::Match(tok.previous(), "[[(,+-*/|=] %var% ]|)|,|;|%op%"))
|
||||
{
|
||||
// initialize reference variable
|
||||
if (Token::Match(tok.tokAt(-3), "& %var% ="))
|
||||
bailOutVar(checks, tok.varId());
|
||||
else
|
||||
use(checks, &tok);
|
||||
return &tok;
|
||||
}
|
||||
|
|
|
@ -155,6 +155,13 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar("void foo()\n"
|
||||
"{\n"
|
||||
" int *x;\n"
|
||||
" int *&y = x;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar("void foo()\n"
|
||||
"{\n"
|
||||
" int x = xyz::x;\n"
|
||||
|
|
Loading…
Reference in New Issue