Fixed segfault in TestTokenizer::cpp0xtemplate3

This commit is contained in:
Daniel Marjamäki 2012-01-15 12:14:47 +01:00
parent 7e3735988d
commit d891d1ce5d
1 changed files with 10 additions and 2 deletions

View File

@ -535,8 +535,16 @@ void TemplateSimplifier::simplifyTemplatesUseDefaultArgumentValues(const std::li
}
for (std::list<Token *>::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();
}
}
}