[clang] [clang] CTAD: implement the missing IsDeducible constraint for alias templates (PR #89358)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 8 01:14:51 PDT 2024


================
@@ -2774,6 +2775,41 @@ Expr *transformRequireClause(Sema &SemaRef, FunctionTemplateDecl *FTD,
   return E.getAs<Expr>();
 }
 
+// Build the associated constraints for the alias deduction guides.
+// C++ [over.match.class.deduct]p3.3:
+//   The associated constraints ([temp.constr.decl]) are the conjunction of the
+//   associated constraints of g and a constraint that is satisfied if and only
+//   if the arguments of A are deducible (see below) from the return type.
+Expr *
+buildAssociatedConstraints(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate,
+                           FunctionTemplateDecl *FTD,
+                           llvm::ArrayRef<TemplateArgument> TransformedArgs,
+                           QualType ReturnType) {
+  auto &Context = SemaRef.Context;
----------------
cor3ntin wrote:

```suggestion
  (const?) ASTContext &Context = SemaRef.Context;
```

https://github.com/llvm/llvm-project/pull/89358


More information about the cfe-commits mailing list