diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 163fef002..e27b76f0d 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -695,7 +695,7 @@ namespace { mRangeAfterVar.second = mEndToken; return; } - if (Token::Match(type, "%name% (") && Token::simpleMatch(type->linkAt(1), ") ;") && !type->isStandardType()) { + if (Token::Match(type, "%name% ( !!(") && Token::simpleMatch(type->linkAt(1), ") ;") && !type->isStandardType()) { mNameToken = type; mEndToken = type->linkAt(1)->next(); mRangeType.first = start; diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index bc8d46a3a..dbd428f99 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -65,6 +65,7 @@ private: TEST_CASE(cfp4); TEST_CASE(cfp5); TEST_CASE(cfp6); + TEST_CASE(cfp7); TEST_CASE(carray1); TEST_CASE(carray2); TEST_CASE(cdonotreplace1); @@ -438,6 +439,13 @@ private: ASSERT_EQUALS("void ( * a [ 10 ] ) ( void ) ;", simplifyTypedef(code)); } + void cfp7() { + const char code[] = "typedef uint32_t ((*fp)(uint32_t n));\n" // #11725 + "uint32_t g();\n" + "fp f;\n"; + ASSERT_EQUALS("uint32_t g ( ) ; uint32_t ( * f ) ( uint32_t n ) ;", simplifyTypedef(code)); + } + void carray1() { const char code[] = "typedef int t[20];\n" "t x;";