public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8433] c++: template template parm pack expansion [PR100372]
@ 2021-05-19  0:56 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2021-05-19  0:56 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:74ad5558d2acddcf4f5e96129ec29dd2f3d47d3a

commit r11-8433-g74ad5558d2acddcf4f5e96129ec29dd2f3d47d3a
Author: Jason Merrill <jason@redhat.com>
Date:   Tue May 18 17:12:37 2021 -0400

    c++: template template parm pack expansion [PR100372]
    
    Here we have a pack expansion of a template template parameter pack, of
    which the pattern is a TEMPLATE_DECL, which strip_typedefs doesn't want to
    see.
    
            PR c++/100372
    
    gcc/cp/ChangeLog:
    
            * tree.c (strip_typedefs): Only look at the pattern of a
            TYPE_PACK_EXPANSION if it's a type.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/cpp0x/alias-decl-ttp1.C: New test.

Diff:
---
 gcc/cp/tree.c                                | 19 ++++++++++++-------
 gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C |  6 ++++++
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index a8bfd5fc053..ced7cb5e977 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1723,13 +1723,18 @@ strip_typedefs (tree t, bool *remove_attributes, unsigned int flags)
       result = finish_underlying_type (type);
       break;
     case TYPE_PACK_EXPANSION:
-      type = strip_typedefs (PACK_EXPANSION_PATTERN (t),
-			     remove_attributes, flags);
-      if (type != PACK_EXPANSION_PATTERN (t))
-	{
-	  result = copy_node (t);
-	  PACK_EXPANSION_PATTERN (result) = type;
-	}
+      {
+	tree pat = PACK_EXPANSION_PATTERN (t);
+	if (TYPE_P (pat))
+	  {
+	    type = strip_typedefs (pat, remove_attributes, flags);
+	    if (type != pat)
+	      {
+		result = copy_node (t);
+		PACK_EXPANSION_PATTERN (result) = type;
+	      }
+	  }
+      }
       break;
     default:
       break;
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C
new file mode 100644
index 00000000000..d1af8d1bbb2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C
@@ -0,0 +1,6 @@
+// PR c++/100372
+// { dg-do compile { target c++14 } }
+
+template <bool> using enable_if_t = int;
+template <class> bool has_P_match_v;
+template <template <class> class... List> enable_if_t<has_P_match_v<List...>> a;


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

only message in thread, other threads:[~2021-05-19  0:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19  0:56 [gcc r11-8433] c++: template template parm pack expansion [PR100372] 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).