[clang] [clang] deprecate frelaxed-template-template-args, make it on by default (PR #89807)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 24 09:48:34 PDT 2024


================
@@ -507,10 +507,62 @@ static TemplateDeductionResult DeduceNonTypeTemplateArgument(
       S, TemplateParams, NTTP, DeducedTemplateArgument(New), T, Info, Deduced);
 }
 
+static NamedDecl *DeduceTemplateArguments(Sema &S, NamedDecl *A,
+                                          TemplateArgument Default) {
+  switch (A->getKind()) {
+  case Decl::TemplateTypeParm: {
+    auto *T = cast<TemplateTypeParmDecl>(A);
+    // FIXME: DefaultArgument can't represent a pack.
+    if (T->isParameterPack())
----------------
mizvekov wrote:

It's possible to write code that hits this condition, in fact such code is already in the clang test suite.

Currently the Decls for Type and Expr parameters don't store a whole TemplateArgument for the default argument, in order to save a few bytes, they store only a TSI and Expr* respectively, which doesn't cover the Pack case.

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


More information about the cfe-commits mailing list