Added test case for #5412.

This commit is contained in:
orbitcowboy 2015-01-22 06:53:11 +01:00
parent dd241501f3
commit 2cfb286558
1 changed files with 25 additions and 0 deletions

View File

@ -1690,7 +1690,32 @@ private:
" return setvalue(x);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
// Ticket #5412 - False negative
{
checkUninitVarB("void f(bool b)\n"
"{\n"
" double f;\n"
" if (b) { }\n"
" else {\n"
" f = 0.0;\n"
" }\n"
" printf (\"%f\",f);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:8]: (error) Uninitialized variable: f\n", errout.str());
// Check for potential FP
checkUninitVarB("void f(bool b)\n"
"{\n"
" double f;\n"
" if (b) { f = 1.0 }\n"
" else {\n"
" f = 0.0;\n"
" }\n"
" printf (\"%f\",f);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
// Ticket #2146 - False negative