#8755: Add regression test (#2160)

* #8755: Add regression test

https://trac.cppcheck.net/ticket/8755
False negative: uninitvar not detected

* Fixed formatting (runastyle)
This commit is contained in:
Sebastian 2019-09-09 17:20:03 +02:00 committed by amai2012
parent 7737a448cf
commit 4a119640c5
1 changed files with 12 additions and 0 deletions

View File

@ -4252,6 +4252,18 @@ private:
" return (*sink)[0];\n"
"}");
ASSERT_EQUALS("", errout.str());
// Ticket #8755
valueFlowUninit("void f(int b) {\n"
" int a;\n"
" if (b == 10)\n"
" a = 1;\n"
" if (b == 13)\n"
" a = 1;\n"
" if (b == 'x') {}\n"
" if (a) {}\n"
"}");
ASSERT_EQUALS("[test.cpp:8]: (error) Uninitialized variable: a\n", errout.str());
}
void uninitvar_ipa() {