Skip to content

Commit 2379239

Browse files
Fix FP ignoredReturnValue (#4783)
1 parent 132a5a3 commit 2379239

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

lib/checkfunctions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void CheckFunctions::checkIgnoredReturnValue()
254254

255255
const Token *parent = tok->next()->astParent();
256256
while (Token::Match(parent, "%cop%")) {
257-
if (Token::Match(parent, "<<|>>") && !parent->astParent())
257+
if (Token::Match(parent, "<<|>>|*") && !parent->astParent())
258258
break;
259259
parent = parent->astParent();
260260
}

test/testfunctions.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,10 @@ class TestFunctions : public TestFixture {
14511451
"}", "test.cpp", &settings2);
14521452
ASSERT_EQUALS("[test.cpp:2]: (warning) Return value of function mystrcmp() is not used.\n", errout.str());
14531453

1454+
check("void f(std::vector<int*> v) {\n"
1455+
" delete *v.begin();\n"
1456+
"}\n");
1457+
ASSERT_EQUALS("", errout.str());
14541458
}
14551459

14561460
void checkIgnoredErrorCode() {

0 commit comments

Comments
 (0)