From 10a4aa62300f082c6f3f2a8d1f6eb9ef4f1bc28e Mon Sep 17 00:00:00 2001 From: Rikard Falkeborn Date: Sat, 9 Nov 2019 23:31:05 +0100 Subject: [PATCH] Add regression test for #9028 Ticket #9028 was fixed in 5800692fa132a, add a test case where the class definition is seen. --- test/testleakautovar.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/testleakautovar.cpp b/test/testleakautovar.cpp index 2dc5f1d0c6f..476850e8c9b 100644 --- a/test/testleakautovar.cpp +++ b/test/testleakautovar.cpp @@ -428,6 +428,15 @@ class TestLeakAutoVar : public TestFixture { " std::string *str = new std::string;" "}", true); TODO_ASSERT_EQUALS("[test.cpp:2]: (error) Memory leak: str\n", "", errout.str()); + + check("class TestType {\n" // #9028 + "public:\n" + " char ca[12];\n" + "};\n" + "void f() {\n" + " TestType *tt = new TestType();\n" + "}", true); + ASSERT_EQUALS("[test.cpp:7]: (error) Memory leak: tt\n", errout.str()); } void realloc1() {