template simplifier: fix another crash (#1774)

This fixes a daca crash in Vc-1.3.3/tests/casts.cpp.
This commit is contained in:
IOBYTE 2019-04-02 03:00:11 -04:00 committed by Daniel Marjamäki
parent b88cc7c19d
commit f5cb289b7d
1 changed files with 17 additions and 15 deletions

View File

@ -1448,6 +1448,7 @@ void TemplateSimplifier::expandTemplate(
if (start->strAt(1) == "<") { if (start->strAt(1) == "<") {
// get the instantiated name // get the instantiated name
Token * closing = start->next()->findClosingBracket(); Token * closing = start->next()->findClosingBracket();
if (closing) {
std::string name; std::string name;
const Token * type = start; const Token * type = start;
while (type && type != closing->next()) { while (type && type != closing->next()) {
@ -1465,6 +1466,7 @@ void TemplateSimplifier::expandTemplate(
break; break;
} }
} }
}
// just copy the token if it wasn't instantiated // just copy the token if it wasn't instantiated
if (start != closing) { if (start != closing) {
dst->insertToken(start->str(), start->originalName(), true); dst->insertToken(start->str(), start->originalName(), true);