template simplifier: fix a template alias TODO test (#1823)

This commit is contained in:
IOBYTE 2019-05-06 13:06:46 -04:00 committed by Daniel Marjamäki
parent f6527fcd9b
commit baeae95bac
2 changed files with 4 additions and 7 deletions

View File

@ -1119,7 +1119,7 @@ void TemplateSimplifier::simplifyTemplateAliases()
}
tok2 = aliasUsage.token->next(); // the '<'
const Token * const endToken1 = templateAlias.token->next()->findClosingBracket();
const Token * const endToken2 = TokenList::copyTokens(tok2, templateAlias.token->tokAt(2), endToken1->previous(), false);
const Token * const endToken2 = TokenList::copyTokens(tok2, templateAlias.token->tokAt(2), endToken1->previous(), false)->next();
for (const Token *tok1 = templateAlias.token->next(); tok2 != endToken2; tok1 = tok1->next(), tok2 = tok2->next()) {
if (!tok2->isName())
continue;
@ -1147,7 +1147,7 @@ void TemplateSimplifier::simplifyTemplateAliases()
endToken = endToken1->next();
// Remove alias usage code (parameters)
Token::eraseTokens(tok2, args.back().second);
Token::eraseTokens(tok2->previous(), args.back().second);
}
if (endToken) {
// Remove all template instantiations in template alias

View File

@ -3397,12 +3397,9 @@ private:
"IntrusivePtr<Vertex<int>> p;";
const char expected[] = "; "
"class Vertex<int> ; "
"boost :: intrusive_ptr < Vertex<int> > p ;"
"boost :: intrusive_ptr < Vertex<int> > p ; "
"class Vertex<int> { } ;";
const char actual[] = "; "
"template < class T > class Vertex { } ; "
"boost :: intrusive_ptr < T > p ;";
TODO_ASSERT_EQUALS(expected, actual, tok(code));
ASSERT_EQUALS(expected, tok(code));
}
unsigned int instantiateMatch(const char code[], const std::size_t numberOfArguments, const char patternAfter[]) {