public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/50830 (another variadic template template parameter issue)
@ 2012-04-17  2:26 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2012-04-17  2:26 UTC (permalink / raw)
  To: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

Here, we were getting confused and thinking that an argument pack of 
template template arguments wasn't suitable for a template template 
parameter pack.  But it is.

Tested x86_64-pc-linux-gnu, applying to trunk.

[-- Attachment #2: 50830.patch --]
[-- Type: text/x-patch, Size: 1728 bytes --]

commit 6143aa83bb48ef7c9d2bbcb0dff13a964036b3d1
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Apr 16 11:53:57 2012 -0400

    	PR c++/50830
    	* pt.c (convert_template_argument): Handle template template
    	argument packs.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7423781..fcefc94 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6428,6 +6428,7 @@ convert_template_argument (tree parm,
   is_tmpl_type = 
     ((TREE_CODE (arg) == TEMPLATE_DECL
       && TREE_CODE (DECL_TEMPLATE_RESULT (arg)) == TYPE_DECL)
+     || (requires_tmpl_type && TREE_CODE (arg) == TYPE_ARGUMENT_PACK)
      || TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM
      || TREE_CODE (arg) == UNBOUND_CLASS_TEMPLATE);
 
@@ -6499,7 +6500,9 @@ convert_template_argument (tree parm,
     {
       if (requires_tmpl_type)
 	{
-	  if (TREE_CODE (TREE_TYPE (arg)) == UNBOUND_CLASS_TEMPLATE)
+	  if (template_parameter_pack_p (parm) && ARGUMENT_PACK_P (orig_arg))
+	    val = orig_arg;
+	  else if (TREE_CODE (TREE_TYPE (arg)) == UNBOUND_CLASS_TEMPLATE)
 	    /* The number of argument required is not known yet.
 	       Just accept it for now.  */
 	    val = TREE_TYPE (arg);
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic129.C b/gcc/testsuite/g++.dg/cpp0x/variadic129.C
new file mode 100644
index 0000000..7118301
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic129.C
@@ -0,0 +1,19 @@
+// PR c++/50830
+// { dg-do compile { target c++11 } }
+
+template<template<class> class...>
+struct list_templates {};
+
+template<class>
+struct aa {};
+
+template<class... T>
+struct test {};
+
+template<template<class> class... F, class T>
+struct test<list_templates<F...>, T>
+{
+    struct inner {};
+};
+
+test<list_templates<aa>, int> a4; // error

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

only message in thread, other threads:[~2012-04-17  2:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-17  2:26 C++ PATCH for c++/50830 (another variadic template template parameter issue) 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).