Fixed #3586 (false positive: uninitvar in argument in namespaced function)
This commit is contained in:
parent
b4d78e3d05
commit
84c0368bfd
|
@ -474,7 +474,7 @@ private:
|
||||||
// variable is assigned like: "( %var% ) .. ="
|
// variable is assigned like: "( %var% ) .. ="
|
||||||
if (Token::Match(tok.previous(), "( %var% )") && tok2 && tok2->str() == "=")
|
if (Token::Match(tok.previous(), "( %var% )") && tok2 && tok2->str() == "=")
|
||||||
ExecutionPath::bailOutVar(checks, tok.varId());
|
ExecutionPath::bailOutVar(checks, tok.varId());
|
||||||
else
|
else if (!(tok.strAt(-2) == ">" && tok.tokAt(-2)->link()))
|
||||||
use(checks, &tok);
|
use(checks, &tok);
|
||||||
//use_array(checks, &tok);
|
//use_array(checks, &tok);
|
||||||
return &tok;
|
return &tok;
|
||||||
|
|
|
@ -864,14 +864,14 @@ private:
|
||||||
|
|
||||||
checkUninitVar("void f()\n"
|
checkUninitVar("void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" char *c1;\n"
|
" char *c1;\n"
|
||||||
" c1=strcpy(c1,\"test\");\n"
|
" c1=strcpy(c1,\"test\");\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: c1\n","", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: c1\n","", errout.str());
|
||||||
|
|
||||||
checkUninitVar("void f(char *c1)\n"
|
checkUninitVar("void f(char *c1)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" c1=strcpy(c1,\"test\");\n"
|
" c1=strcpy(c1,\"test\");\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
@ -1777,6 +1777,12 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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..
|
// using uninitialized function pointer..
|
||||||
checkUninitVar("void foo()\n"
|
checkUninitVar("void foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue