diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index eafc2800e..7a9da6361 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1621,8 +1621,11 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s // skip default values if (tok->str() == "=") { - while (tok->str() != "," && tok->str() != ")") + while (tok->str() != "," && tok->str() != ")") { + if (tok->link()) + tok = tok->link(); tok = tok->next(); + } } argumentList.push_back(Variable(nameTok, startTok, endTok, count++, Argument, argType, functionScope)); diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 98c0701f9..60aac8951 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -852,6 +852,12 @@ private: ASSERT(g && g->type == Scope::eFunction && g->function && g->function->argumentList.size() == 1 && g->function->argumentList.front().index() == 0); ASSERT_EQUALS("", errout.str()); } + { + GET_SYMBOL_DB("void g(std::map m = std::map()) { }"); + const Scope* g = db->findScopeByName("g"); + ASSERT(g && g->type == Scope::eFunction && g->function && g->function->argumentList.size() == 1 && g->function->argumentList.front().index() == 0 && g->function->initializedArgCount() == 1); + ASSERT_EQUALS("", errout.str()); + } } void functionArgs2() {