diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 8699fe422..27437962e 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -231,6 +231,7 @@ private: TEST_CASE(func21); // Ticket #2569 TEST_CASE(func22); // Ticket #2668 TEST_CASE(func23); // Ticket #2667 + TEST_CASE(func24); // Ticket #2705 TEST_CASE(allocfunc1); TEST_CASE(allocfunc2); @@ -2181,6 +2182,23 @@ private: ASSERT_EQUALS("", errout.str()); } + // #2705 + void func24() + { + check("void f(void) \n" + "{\n" + " std::string *x = new std::string;\n" + "}\n"); + TODO_ASSERT_EQUALS("[test.cpp:3]: (error) Memory leak: x\n","", errout.str()); + + check("void f(void) \n" + "{\n" + " std::string *x = new std::string;\n" + " delete x;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } + void allocfunc1() { check("static char *a()\n"