public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-8669] c++: alias CTAD and template template parm [PR114377]
@ 2024-05-01 20:31 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2024-05-01 20:31 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:60e1e13f458f1fcfb05a30ace57fa682461e2732

commit r13-8669-g60e1e13f458f1fcfb05a30ace57fa682461e2732
Author: centurion <centurion009@proton.me>
Date:   Wed Mar 27 18:36:37 2024 +0000

    c++: alias CTAD and template template parm [PR114377]
    
    To match all the other places that pull a _TEMPLATE_PARM out of a
    _DECL (get_template_parm_index, etc.).
    
    This change is too small to be legally significant for copyright.
    
            PR c++/114377
    
    gcc/cp/ChangeLog:
    
            * 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.
    
    Reviewed-by: Jason Merrill <jason@redhat.com>
    (cherry picked from commit 801e82acd6b4f0cf863529875947e394899ea7b9)

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

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index a768d11c82f..fa660fcf49e 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -10917,7 +10917,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" }
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-01 20:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-01 20:31 [gcc r13-8669] c++: alias CTAD and template template parm [PR114377] Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).