Uninitialized variables; Added TP tests for ignored operators

This commit is contained in:
Daniel Marjamäki 2021-05-24 17:53:16 +02:00
parent b7803ea6fb
commit d3bb84cd0e
1 changed files with 12 additions and 0 deletions

View File

@ -2333,11 +2333,23 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
checkUninitVar("int foo() {\n"
" int i;\n"
" return (int&)i + 2;\n"
"}");
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: i\n", errout.str());
checkUninitVar("void foo() {\n"
" int i;\n"
" dostuff(*&i, 0);\n" // <- *& is not use
"}");
ASSERT_EQUALS("", errout.str());
checkUninitVar("int foo() {\n"
" int i;\n"
" return *&i;\n"
"}");
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: i\n", errout.str());
}
void uninitvar2() {