Skip to content

Commit 5e537a6

Browse files
Fix --check-library warning for int(i) (#4293)
1 parent c736fe8 commit 5e537a6

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

lib/checkleakautovar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static bool isLocalVarNoAutoDealloc(const Token *varTok, const bool isCpp)
268268

269269
static const Token * isFunctionCall(const Token * nameToken)
270270
{
271-
if (nameToken->isName()) {
271+
if (!nameToken->isStandardType() && nameToken->isName()) {
272272
nameToken = nameToken->next();
273273
// check if function is a template
274274
if (nameToken && nameToken->link() && nameToken->str() == "<") {

test/testleakautovar.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ class TestLeakAutoVar : public TestFixture {
208208
TEST_CASE(configuration2);
209209
TEST_CASE(configuration3);
210210
TEST_CASE(configuration4);
211+
TEST_CASE(configuration5);
211212

212213
TEST_CASE(ptrptr);
213214

@@ -2371,6 +2372,13 @@ class TestLeakAutoVar : public TestFixture {
23712372
ASSERT_EQUALS("[test.c:4]: (information) --check-library: Function set_data() should have <use>/<leak-ignore> configuration\n", errout.str());
23722373
}
23732374

2375+
void configuration5() {
2376+
check("void f() {\n"
2377+
" int(i);\n"
2378+
"}\n");
2379+
ASSERT_EQUALS("", errout.str());
2380+
}
2381+
23742382
void ptrptr() {
23752383
check("void f() {\n"
23762384
" char **p = malloc(10);\n"

0 commit comments

Comments
 (0)