From 7f67438d9902b6c527bdb085586c6d79c86151e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 20 Feb 2011 19:45:34 +0100 Subject: [PATCH] Null pointer: Added TODO test case. Ticket: #2379 --- test/testnullpointer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index 96a59d282..635973e0c 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -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"