diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 54639fc35..bf7d13f8e 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -886,6 +886,9 @@ static Token *processFunc(Token *tok2, bool inOperator) tok2 = tok2->tokAt(4)->link()->next(); else if (Token::Match(tok2->next(), "* ( * %type% (")) tok2 = tok2->tokAt(5)->link()->next(); + else if (Token::Match(tok2->next(), "* [") && + Token::simpleMatch(tok2->tokAt(2)->link(), "] ;")) + tok2 = tok2->next(); else { if (tok2->next()->str() == "(") diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 3ee94725f..da1994a81 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -241,6 +241,7 @@ private: TEST_CASE(simplifyTypedef79); // ticket #2348 TEST_CASE(simplifyTypedef80); // ticket #2587 TEST_CASE(simplifyTypedef81); // ticket #2603 + TEST_CASE(simplifyTypedef82); // ticket #2403 TEST_CASE(simplifyTypedefFunction1); TEST_CASE(simplifyTypedefFunction2); // ticket #1685 @@ -4931,6 +4932,24 @@ private: ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str()); } + void simplifyTypedef82() // ticket #2403 + { + checkSimplifyTypedef("class A {\n" + "public:\n" + " typedef int F(int idx);\n" + "};\n" + "class B {\n" + "public:\n" + " A::F ** f;\n" + "};\n" + "int main()\n" + "{\n" + " B * b = new B;\n" + " b->f = new A::F * [ 10 ];\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } + void simplifyTypedefFunction1() { {