Skip to content

Commit c851d6c

Browse files
committed
When performing a substitution into a dependent alias template, mark the
outer levels as retained rather than omitting their arguments. This better reflects what's going on (we're performing a substitution while still inside a template). In theory this is also more correct, but I've not found a testcase where it matters in practice (largely because we don't allow alias templates to be declared inside a function).
1 parent c7fbe21 commit c851d6c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3558,9 +3558,8 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
35583558
// Only substitute for the innermost template argument list.
35593559
MultiLevelTemplateArgumentList TemplateArgLists;
35603560
TemplateArgLists.addOuterTemplateArguments(&StackTemplateArgs);
3561-
unsigned Depth = AliasTemplate->getTemplateParameters()->getDepth();
3562-
for (unsigned I = 0; I < Depth; ++I)
3563-
TemplateArgLists.addOuterTemplateArguments(None);
3561+
TemplateArgLists.addOuterRetainedLevels(
3562+
AliasTemplate->getTemplateParameters()->getDepth());
35643563

35653564
LocalInstantiationScope Scope(*this);
35663565
InstantiatingTemplate Inst(*this, TemplateLoc, Template);

0 commit comments

Comments
 (0)