[clang] [clang] Implement transforms for DeducedTemplateName (PR #108491)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 15 18:41:41 PDT 2024


https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/108491

>From d0863742db50da3ac9b4ea2ec12ba55001a7ce63 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov at gmail.com>
Date: Fri, 13 Sep 2024 02:21:36 -0300
Subject: [PATCH] [clang] Fix incorrect partial ordering context setting

Fixes regression introduced in #94981, reported on the pull-request.

Since this fixes a commit which was never released, there are no
release notes.
---
 clang/lib/Sema/SemaTemplateDeduction.cpp |  2 +-
 clang/test/SemaTemplate/cwg2398.cpp      | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 562c57a41299a9..b50648d5752ce5 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -3411,7 +3411,7 @@ DeduceTemplateArguments(Sema &S, T *Partial,
   if (TemplateDeductionResult Result = ::DeduceTemplateArguments(
           S, Partial->getTemplateParameters(),
           Partial->getTemplateArgs().asArray(), TemplateArgs, Info, Deduced,
-          /*NumberOfArgumentsMustMatch=*/false, /*PartialOrdering=*/true,
+          /*NumberOfArgumentsMustMatch=*/false, /*PartialOrdering=*/false,
           PackFold::ParameterToArgument,
           /*HasDeducedAnyParam=*/nullptr);
       Result != TemplateDeductionResult::Success)
diff --git a/clang/test/SemaTemplate/cwg2398.cpp b/clang/test/SemaTemplate/cwg2398.cpp
index 1d9747276fbe00..6dc7af6ea17899 100644
--- a/clang/test/SemaTemplate/cwg2398.cpp
+++ b/clang/test/SemaTemplate/cwg2398.cpp
@@ -379,3 +379,13 @@ namespace regression1 {
     bar(input);
   }
 } // namespace regression1
+
+namespace regression2 {
+  template <class> struct D {};
+
+  template <class ET, template <class> class VT>
+  struct D<VT<ET>>;
+
+  template <typename, int> struct Matrix;
+  template struct D<Matrix<double, 3>>;
+} // namespace regression2



More information about the cfe-commits mailing list