Skip to content

Commit 2d326c0

Browse files
rikardfalkeborndanmar
authored andcommitted
Add regression test for #9028 (#2343)
Ticket #9028 was fixed in 5800692, add a test case where the class definition is seen.
1 parent 11319a3 commit 2d326c0

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/testleakautovar.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,15 @@ class TestLeakAutoVar : public TestFixture {
428428
" std::string *str = new std::string;"
429429
"}", true);
430430
TODO_ASSERT_EQUALS("[test.cpp:2]: (error) Memory leak: str\n", "", errout.str());
431+
432+
check("class TestType {\n" // #9028
433+
"public:\n"
434+
" char ca[12];\n"
435+
"};\n"
436+
"void f() {\n"
437+
" TestType *tt = new TestType();\n"
438+
"}", true);
439+
ASSERT_EQUALS("[test.cpp:7]: (error) Memory leak: tt\n", errout.str());
431440
}
432441

433442
void realloc1() {

0 commit comments

Comments
 (0)