Fix issue 7836: Add regression test (#2308)

This commit is contained in:
Paul Fultz II 2019-10-30 06:12:02 -05:00 committed by amai2012
parent 02c0240dcd
commit 02150e741d
1 changed files with 9 additions and 0 deletions

View File

@ -4272,6 +4272,15 @@ private:
" if (a) {}\n" " if (a) {}\n"
"}"); "}");
ASSERT_EQUALS("[test.cpp:8]: (error) Uninitialized variable: a\n", errout.str()); ASSERT_EQUALS("[test.cpp:8]: (error) Uninitialized variable: a\n", errout.str());
valueFlowUninit("void test(int p) {\n"
" int f;\n"
" if (p > 0)\n"
" f = 0;\n"
" if (p > 1)\n"
" f += 1;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
} }
void uninitvar_ipa() { void uninitvar_ipa() {