Applied, thanks!

BTW, in future please see

  https://gcc.gnu.org/contribute.html#legal

This patch is small enough to not need to worry about copyright, but for larger patches we would.

On 3/27/24 14:36, centurion wrote:

        PR c++/114377

gcc/cp/ChangeLog:

        PR c++/114377
        * pt.cc (find_template_parameter_info::found): Use TREE_TYPE for
        TEMPLATE_DECL instead of DECL_INITIAL.

gcc/testsuite/ChangeLog:

        * g++.dg/cpp2a/class-deduction-alias19.C: New test.
---
  gcc/cp/pt.cc                                      |  3 ++-
  .../g++.dg/cpp2a/class-deduction-alias19.C        | 15 +++++++++++++++
  2 files changed, 17 insertions(+), 1 deletion(-)
  create mode 100644 gcc/testsuite/g++.dg/cpp2a/class-deduction-alias19.C

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 7b00a8615d2..1425d6116d0 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -11032,7 +11032,8 @@ find_template_parameter_info::found (tree parm)
  {
    if (TREE_CODE (parm) == TREE_LIST)
      parm = TREE_VALUE (parm);
-  if (TREE_CODE (parm) == TYPE_DECL)
+  if (TREE_CODE (parm) == TYPE_DECL
+      || TREE_CODE (parm) == TEMPLATE_DECL)
      parm = TREE_TYPE (parm);
    else
      parm = DECL_INITIAL (parm);
diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias19.C 
b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias19.C
new file mode 100644
index 00000000000..1ea79bd7691
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias19.C
@@ -0,0 +1,15 @@
+// PR c++/114377
+// { dg-do compile { target c++20 } }
+
+template <template <typename> typename Iterator>
+struct K {};
+
+template <typename C, typename IteratorPolicy>
+class Foo {};
+
+template <typename C, template<typename> typename TTP>
+using Bar = Foo<C, K<TTP>>;
+
+void s() {
+    Bar(1); // { dg-error "failed|no match" }
+}

Reply via email to