Ticket #4716: Added a regression test

This commit is contained in:
orbitcowboy 2021-10-15 22:50:29 +02:00
parent 0dfc5a6dcd
commit d4a98dfaab
1 changed files with 10 additions and 0 deletions

View File

@ -3090,6 +3090,16 @@ private:
// Handling of function calls
void uninitvar2_func() {
// #4716
checkUninitVar("void bar(const int a, const int * const b);\n"
"int foo(void) {\n"
" int a;\n"
" int *b = 0;\n"
" bar(a,b);\n" // <<
" return 0;\n"
"}");
ASSERT_EQUALS("[test.cpp:5]: (error) Uninitialized variable: a\n", errout.str());
// non-pointer variable
checkUninitVar("void a(char);\n" // value => error
"void b() {\n"