[clang] [Clang][C++26] Implement P3865R1 - CTAD for type template template parameters (PR #191409)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 15 11:09:59 PDT 2026
================
@@ -1604,3 +1604,60 @@ void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template,
SavedContext.pop();
}
+
+TypeAliasTemplateDecl *Sema::BuildAliasForCTADFromTypeTemplateParameter(
+ TemplateTemplateParmDecl *D, TemplateName Replacement, SourceLocation Loc) {
+
+ // [C++26] [over.match.class.deduct]p3
+ // When resolving a placeholder for a deduced class type where the
+ // template-name designates a type template template parameter P, let A be an
+ // alias template whose template parameter list is that of P and whose
+ // defining-type-id designates the type template template argument with a
+ // simpletemplate-id in which the template-argument-list consists of a list of
+ // identifiers naming each template-parameter of P, with the argument being a
+ // pack expansion if the template-parameter is a pack. A is then used instead
+ // of the original template-name to resolve the placeholder
+
+ LocalInstantiationScope Scope(SemaRef);
+
+ auto &AST = SemaRef.getASTContext();
+ auto *Ctx = CurContext->getParent();
----------------
ojhunt wrote:
nit: I think this should be DeclContext* rather than auto, and I'd prefer Ctx be given a clearer name -ParentCtx would seem reasonable?
That would also make it more reasonable to use Context or Ctx for the local ASTContext reference
https://github.com/llvm/llvm-project/pull/191409
More information about the cfe-commits
mailing list