re PR c++/64514 (Error in template instantiation in GCC 4.9, works fine in GCC 4.8)
authorJason Merrill <jason@redhat.com>
Tue, 13 Jan 2015 21:04:35 +0000 (16:04 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 13 Jan 2015 21:04:35 +0000 (16:04 -0500)
PR c++/64514
* pt.c (coerce_template_parameter_pack): Return NULL for a
zero-length fixed parameter pack with a pack expansion arg.

From-SVN: r219558

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/variadic165.C [new file with mode: 0644]

index 0e94fe136a4c0194870dfa7e4b18a13013b9cb76..668b13bc1be2ea10ce0fc52620efcca1b224051d 100644 (file)
@@ -1,5 +1,9 @@
 2015-01-13  Jason Merrill  <jason@redhat.com>
 
+       PR c++/64514
+       * pt.c (coerce_template_parameter_pack): Return NULL for a
+       zero-length fixed parameter pack with a pack expansion arg.
+
        PR c++/64520
        * pt.c (unify): Don't try to deduce to std::initializer_list<T...>.
 
index 3ac93db948a3086574fe8f653e1790ec57f24718..55871e5b6db758da11b404d2c1f32b9aa83b9a79 100644 (file)
@@ -6825,6 +6825,9 @@ coerce_template_parameter_pack (tree parms,
               if (invalid_nontype_parm_type_p (t, complain))
                 return error_mark_node;
             }
+         /* We don't know how many args we have yet, just
+            use the unconverted ones for now.  */
+         return NULL_TREE;
         }
 
       packed_args = make_tree_vec (TREE_VEC_LENGTH (packed_parms));
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic165.C b/gcc/testsuite/g++.dg/cpp0x/variadic165.C
new file mode 100644 (file)
index 0000000..862931f
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/64514
+// { dg-do compile { target c++11 } }
+
+template<typename... T>
+struct Functor
+{
+    template <T...>
+    struct Inner
+    {};
+};
+
+template struct Functor<>::Inner<>;
+
+int main()
+{
+
+}