Null pointer: Added TODO test case. Ticket: #2379

This commit is contained in:
Daniel Marjamäki 2011-02-20 19:45:34 +01:00
parent 63c003f92e
commit 7f67438d99
1 changed files with 8 additions and 0 deletions

View File

@ -207,6 +207,14 @@ private:
"}\n");
ASSERT_EQUALS("[test.cpp:2]: (error) Possible null pointer dereference: abc - otherwise it is redundant to check if abc is null at line 3\n", errout.str());
check("void foo(ABC *abc) {\n"
" if (abc->a == 3) {\n"
" return;\n"
" }\n"
" if (abc) {}\n"
"}");
TODO_ASSERT_EQUALS("[test.cpp:2]: (error) Possible null pointer dereference: abc - otherwise it is redundant to check if abc is null at line 5\n", "", errout.str());
// TODO: False negative if member of member is dereferenced
check("void foo(ABC *abc) {\n"
" abc->next->a = 0;\n"