diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 46ea56c5c..0199ceebc 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -535,8 +535,16 @@ void TemplateSimplifier::simplifyTemplatesUseDefaultArgumentValues(const std::li } for (std::list::iterator it = eq.begin(); it != eq.end(); ++it) { - (*it)->deleteNext(); - (*it)->deleteThis(); + Token * const eqtok = *it; + const Token *tok2; + for (tok2 = eqtok->next(); tok2; tok2 = tok2->next()) { + if (tok2->str() == "(") + tok2 = tok2->link(); + else if (tok2->str() == "," || tok2->str() == ">") + break; + } + Token::eraseTokens(eqtok, tok2); + eqtok->deleteThis(); } } }