diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index e4026c694..4a6e14823 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -3863,6 +3863,10 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s nameTok = tok->tokAt(2); endTok = nameTok->previous(); tok = tok->link()->tokAt(2); + } else if (tok != startTok && !nameTok && Token::Match(tok, "( * %var% ) [")) { + nameTok = tok->tokAt(2); + endTok = nameTok->previous(); + tok = tok->link(); } else if (tok->varId() != 0) { nameTok = tok; endTok = tok->previous(); diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 77ef25b84..5dde9d7e1 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -245,6 +245,7 @@ private: TEST_CASE(functionArgs15); // #7159 TEST_CASE(functionArgs16); // #9591 TEST_CASE(functionArgs17); + TEST_CASE(functionArgs18); // #10376 TEST_CASE(functionImplicitlyVirtual); @@ -2490,6 +2491,15 @@ private: ASSERT_EQUALS(3, func->argCount()); } + void functionArgs18() { + const char code[] = "void f(int (*param1)[2], int param2) {}"; + GET_SYMBOL_DB(code); + ASSERT(db != nullptr); + const Scope *scope = db->functionScopes.front(); + const Function *func = scope->function; + ASSERT_EQUALS(2, func->argCount()); + } + void functionImplicitlyVirtual() { GET_SYMBOL_DB("class base { virtual void f(); };\n" "class derived : base { void f(); };\n"