Test case for #863 (false positive memset array of pointers)

http://sourceforge.net/apps/trac/cppcheck/ticket/863
This commit is contained in:
Reijo Tomperi 2009-10-27 20:54:35 +02:00
parent 59acfbc4df
commit 0e695ea527
1 changed files with 7 additions and 0 deletions

View File

@ -1061,6 +1061,13 @@ private:
" memset(s, 5, '*');\n" " memset(s, 5, '*');\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:4]: (possible error) The size argument is given as a char constant\n", errout.str()); ASSERT_EQUALS("[test.cpp:4]: (possible error) The size argument is given as a char constant\n", errout.str());
check("void foo()\n"
"{\n"
" int* x[5];\n"
" memset(x, 0, sizeof(x));\n"
"}\n");
ASSERT_EQUALS("", errout.str());
} }
void counter_test() void counter_test()