public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/50303 (failure using template template parameter pack in a pack expansion)
@ 2012-04-17  2:52 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2012-04-17  2:52 UTC (permalink / raw)
  To: gcc-patches List

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

When substituting into a template template parameter pack pattern with a 
set of template arguments, we want to use tsubst_expr so that we get the 
substituted result; tsubst tries and fails to build up a new template 
template parameter.

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

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

commit d04f9e7b78c9355e7b7835dc00fca3dfa4acc666
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Apr 16 11:31:59 2012 -0400

    	PR c++/50303
    	* pt.c (tsubst_pack_expansion): Use tsubst_expr for template
    	template parameters.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 95d0aba..7423781 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -9518,7 +9518,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
         }
 
       /* Substitute into the PATTERN with the altered arguments.  */
-      if (TREE_CODE (t) == EXPR_PACK_EXPANSION)
+      if (!TYPE_P (pattern))
         TREE_VEC_ELT (result, i) = 
           tsubst_expr (pattern, args, complain, in_decl,
                        /*integral_constant_expression_p=*/false);
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic128.C b/gcc/testsuite/g++.dg/cpp0x/variadic128.C
new file mode 100644
index 0000000..8c2d3b2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic128.C
@@ -0,0 +1,16 @@
+// PR c++/50303
+// { dg-do compile { target c++11 } }
+
+template<typename Interface>
+struct A1 {
+};
+
+template<template<class I> class... Actions>
+void g2() {
+  g2<Actions...>();
+}
+
+int main()
+{
+  g2<A1>();
+}

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

only message in thread, other threads:[~2012-04-17  2:52 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:52 C++ PATCH for c++/50303 (failure using template template parameter pack in a pack expansion) 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).