Skip to content

Commit baeae95

Browse files
IOBYTEdanmar
authored andcommitted
template simplifier: fix a template alias TODO test (#1823)
1 parent f6527fc commit baeae95

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

lib/templatesimplifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ void TemplateSimplifier::simplifyTemplateAliases()
11191119
}
11201120
tok2 = aliasUsage.token->next(); // the '<'
11211121
const Token * const endToken1 = templateAlias.token->next()->findClosingBracket();
1122-
const Token * const endToken2 = TokenList::copyTokens(tok2, templateAlias.token->tokAt(2), endToken1->previous(), false);
1122+
const Token * const endToken2 = TokenList::copyTokens(tok2, templateAlias.token->tokAt(2), endToken1->previous(), false)->next();
11231123
for (const Token *tok1 = templateAlias.token->next(); tok2 != endToken2; tok1 = tok1->next(), tok2 = tok2->next()) {
11241124
if (!tok2->isName())
11251125
continue;
@@ -1147,7 +1147,7 @@ void TemplateSimplifier::simplifyTemplateAliases()
11471147
endToken = endToken1->next();
11481148

11491149
// Remove alias usage code (parameters)
1150-
Token::eraseTokens(tok2, args.back().second);
1150+
Token::eraseTokens(tok2->previous(), args.back().second);
11511151
}
11521152
if (endToken) {
11531153
// Remove all template instantiations in template alias

test/testsimplifytemplate.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3397,12 +3397,9 @@ class TestSimplifyTemplate : public TestFixture {
33973397
"IntrusivePtr<Vertex<int>> p;";
33983398
const char expected[] = "; "
33993399
"class Vertex<int> ; "
3400-
"boost :: intrusive_ptr < Vertex<int> > p ;"
3400+
"boost :: intrusive_ptr < Vertex<int> > p ; "
34013401
"class Vertex<int> { } ;";
3402-
const char actual[] = "; "
3403-
"template < class T > class Vertex { } ; "
3404-
"boost :: intrusive_ptr < T > p ;";
3405-
TODO_ASSERT_EQUALS(expected, actual, tok(code));
3402+
ASSERT_EQUALS(expected, tok(code));
34063403
}
34073404

34083405
unsigned int instantiateMatch(const char code[], const std::size_t numberOfArguments, const char patternAfter[]) {

0 commit comments

Comments
 (0)