Skip to content

Commit c610346

Browse files
committed
Fix #14853 FP funcArgNamesDifferentUnnamed with function pointer argument
1 parent 051584c commit c610346

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

lib/checkother.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4052,7 +4052,7 @@ void CheckOtherImpl::checkFuncArgNamesDifferent()
40524052
break;
40534053
}
40544054
// skip over templates and arrays
4055-
if (decl->link() && !Token::Match(decl, "[()]"))
4055+
if (decl->link() && (!Token::Match(decl, "[()]") || Token::simpleMatch(decl->tokAt(-1), ") (")))
40564056
decl = decl->link();
40574057
else if (decl->varId())
40584058
declarations[j] = decl;

test/testother.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12959,6 +12959,10 @@ class TestOther : public TestFixture {
1295912959
check("void f(void (*fp)(), int x);\n" // #14847
1296012960
"void f(void (*fp)(), int x) {}\n");
1296112961
ASSERT_EQUALS("", errout_str());
12962+
12963+
check("void f(void (*fp)(int a, int b), int b);\n" // #14853
12964+
"void f(void (*fp)(int a, int b), int b) {}\n");
12965+
ASSERT_EQUALS("", errout_str());
1296212966
}
1296312967

1296412968
void funcArgOrderDifferent() {

0 commit comments

Comments
 (0)