Skip code in brackets in default argument declaration (fixes #4057)
This commit is contained in:
parent
31e7e41098
commit
20f989b6c4
|
@ -1621,9 +1621,12 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
|
||||||
|
|
||||||
// skip default values
|
// skip default values
|
||||||
if (tok->str() == "=") {
|
if (tok->str() == "=") {
|
||||||
while (tok->str() != "," && tok->str() != ")")
|
while (tok->str() != "," && tok->str() != ")") {
|
||||||
|
if (tok->link())
|
||||||
|
tok = tok->link();
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
argumentList.push_back(Variable(nameTok, startTok, endTok, count++, Argument, argType, functionScope));
|
argumentList.push_back(Variable(nameTok, startTok, endTok, count++, Argument, argType, functionScope));
|
||||||
|
|
||||||
|
|
|
@ -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(g && g->type == Scope::eFunction && g->function && g->function->argumentList.size() == 1 && g->function->argumentList.front().index() == 0);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
GET_SYMBOL_DB("void g(std::map<int, int> m = std::map<int, int>()) { }");
|
||||||
|
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() {
|
void functionArgs2() {
|
||||||
|
|
Loading…
Reference in New Issue