diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index dc2391425fe..8e70fb32ad6 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -517,7 +517,7 @@ const Token *Tokenizer::processFunc(const Token *tok2, bool inOperator) const tok2 = tok2->next(); while (Token::Match(tok2, "*|&") && - !Token::Match(tok2->next(), ")|>")) + !Token::Match(tok2->next(), "[)>,]")) tok2 = tok2->next(); // skip over namespace diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index 158434f2245..a9ba778d635 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -56,6 +56,7 @@ class TestSimplifyTypedef : public TestFixture { TEST_CASE(cfunction1); TEST_CASE(cfunction2); TEST_CASE(cfunction3); + TEST_CASE(cfunction4); TEST_CASE(cfp1); TEST_CASE(cfp2); TEST_CASE(cfp4); @@ -415,6 +416,12 @@ class TestSimplifyTypedef : public TestFixture { ASSERT_EQUALS("[file.c:2]: (portability) It is unspecified behavior to const qualify a function type.\n", errout_str()); } + void cfunction4() { + const char code[] = "typedef int (func_t) (int);\n" // #12625 + "int f(int*, func_t*, int);\n"; + ASSERT_EQUALS("int f ( int * , int ( * ) ( int ) , int ) ;", simplifyTypedefC(code)); + } + void cfp1() { const char code[] = "typedef void (*fp)(void * p);\n" "fp x;";