Skip to content

Commit f97bab8

Browse files
Add test for #12062 (#6102)
1 parent b564fdd commit f97bab8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/testleakautovar.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3203,6 +3203,14 @@ class TestLeakAutoVarStrcpy : public TestFixture {
32033203
" p->f();\n"
32043204
"}");
32053205
ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: p\n", errout.str());
3206+
3207+
check("class B { std::string s; };\n" // #12062
3208+
"class D : public B {};\n"
3209+
"void g() {\n"
3210+
" auto d = new D();\n"
3211+
" if (d) {}\n"
3212+
"}\n");
3213+
ASSERT_EQUALS("[test.cpp:6]: (error) Memory leak: d\n", errout.str());
32063214
}
32073215
};
32083216

0 commit comments

Comments
 (0)