diff --git a/test/testother.cpp b/test/testother.cpp index 16563ba59..e16fd3562 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -69,6 +69,7 @@ private: TEST_CASE(nullpointer6); TEST_CASE(nullpointer7); TEST_CASE(nullpointer8); + TEST_CASE(nullpointer9); TEST_CASE(uninitvar1); TEST_CASE(uninitvar_alloc); // data is allocated but not initialized @@ -1151,6 +1152,16 @@ private: ASSERT_EQUALS("[test.cpp:4]: (error) Possible null pointer dereference: x\n", errout.str()); } + void nullpointer9() //#ticket 1778 + { + checkNullPointer("void foo()\n" + "{\n" + " std::string * x = 0;\n" + " *x = \"test\";\n" + "}\n"); + TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Possible null pointer dereference: x\n", errout.str()); + } + void checkUninitVar(const char code[]) { // Tokenize..