[clang] c851d6c - When performing a substitution into a dependent alias template, mark the
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 17 15:12:17 PDT 2020
Author: Richard Smith
Date: 2020-06-17T15:12:04-07:00
New Revision: c851d6cf4a4ab803d01d0059f4659f4f9f4435ea
URL: https://github.com/llvm/llvm-project/commit/c851d6cf4a4ab803d01d0059f4659f4f9f4435ea
DIFF: https://github.com/llvm/llvm-project/commit/c851d6cf4a4ab803d01d0059f4659f4f9f4435ea.diff
LOG: 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).
Added:
Modified:
clang/lib/Sema/SemaTemplate.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 073b4e818a24..3292284d63ba 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -3558,9 +3558,8 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
// Only substitute for the innermost template argument list.
MultiLevelTemplateArgumentList TemplateArgLists;
TemplateArgLists.addOuterTemplateArguments(&StackTemplateArgs);
- unsigned Depth = AliasTemplate->getTemplateParameters()->getDepth();
- for (unsigned I = 0; I < Depth; ++I)
- TemplateArgLists.addOuterTemplateArguments(None);
+ TemplateArgLists.addOuterRetainedLevels(
+ AliasTemplate->getTemplateParameters()->getDepth());
LocalInstantiationScope Scope(*this);
InstantiatingTemplate Inst(*this, TemplateLoc, Template);
More information about the cfe-commits
mailing list