Add regression test for #9187 (#2548)

This was fixed in ae0a73a53.
This commit is contained in:
Rikard Falkeborn 2020-02-22 21:26:26 +01:00 committed by GitHub
parent 84d2c86d74
commit 1f668c8dc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -76,6 +76,7 @@ private:
TEST_CASE(assign17); // #9047
TEST_CASE(assign18);
TEST_CASE(assign19);
TEST_CASE(assign20); // #9187
TEST_CASE(isAutoDealloc);
@ -413,6 +414,13 @@ private:
ASSERT_EQUALS("", errout.str());
}
void assign20() { // #9187
check("void f() {\n"
" char *p = static_cast<int>(malloc(10));\n"
"}", true);
ASSERT_EQUALS("[test.cpp:3]: (error) Memory leak: p\n", errout.str());
}
void isAutoDealloc() {
check("void f() {\n"
" char *p = new char[100];"