Fixed #3586 (false positive: uninitvar in argument in namespaced function)

This commit is contained in:
Daniel Marjamäki 2012-09-15 10:48:17 +02:00
parent b4d78e3d05
commit 84c0368bfd
2 changed files with 10 additions and 4 deletions

View File

@ -474,7 +474,7 @@ private:
// variable is assigned like: "( %var% ) .. ="
if (Token::Match(tok.previous(), "( %var% )") && tok2 && tok2->str() == "=")
ExecutionPath::bailOutVar(checks, tok.varId());
else
else if (!(tok.strAt(-2) == ">" && tok.tokAt(-2)->link()))
use(checks, &tok);
//use_array(checks, &tok);
return &tok;

View File

@ -1777,6 +1777,12 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
checkUninitVar("void f() {\n" // #3586 - calling template function
" int i;\n"
" a::b<int>(i);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
// using uninitialized function pointer..
checkUninitVar("void foo()\n"
"{\n"