This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH for c++/58466 (ICE with variadics and partial specialization)


Here the problem was that when we built up A<'X'> the arguments to A were 'X' and the empty set for the parameter pack. When we then use that to deduce the arguments for C, we got confused by the empty set and tried to treat it as another argument, leading to bad times. Fixed by calling expand_template_argument_pack in unify_pack_expansion.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 8494bec4e85a987375b3e1044574ddb89fa6e120
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Jan 29 15:37:41 2014 -0500

    	PR c++/58466
    	* pt.c (unify_pack_expansion): Call expand_template_argument_pack.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 943255d..9be9171 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -16897,6 +16897,9 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
   tree pattern = PACK_EXPANSION_PATTERN (parm);
   tree pack, packs = NULL_TREE;
   int i, start = TREE_VEC_LENGTH (packed_parms) - 1;
+
+  packed_args = expand_template_argument_pack (packed_args);
+
   int len = TREE_VEC_LENGTH (packed_args);
 
   /* Determine the parameter packs we will be deducing from the
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic147.C b/gcc/testsuite/g++.dg/cpp0x/variadic147.C
new file mode 100644
index 0000000..7f606d8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic147.C
@@ -0,0 +1,10 @@
+// PR c++/58466
+// { dg-require-effective-target c++11 }
+
+template<char, char...> struct A;
+
+template<typename> struct B;
+
+template<char... C> struct B<A<C...>> {};
+
+B<A<'X'>> b;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]