re PR c++/60219 ([c++11] ICE invalid use of variadic template)
authorJason Merrill <jason@redhat.com>
Fri, 21 Feb 2014 14:57:00 +0000 (09:57 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 21 Feb 2014 14:57:00 +0000 (09:57 -0500)
PR c++/60219
* pt.c (coerce_template_parms): Bail if argument packing fails.

From-SVN: r208003

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

index 62aacd6..9ddd8f8 100644 (file)
@@ -1,5 +1,8 @@
 2014-02-21  Jason Merrill  <jason@redhat.com>
 
+       PR c++/60219
+       * pt.c (coerce_template_parms): Bail if argument packing fails.
+
        PR c++/60224
        * decl.c (cp_complete_array_type, maybe_deduce_size_from_array_init):
        Don't get confused by a CONSTRUCTOR that already has a type.
index 0f576a5..bf41e86 100644 (file)
@@ -6808,6 +6808,8 @@ coerce_template_parms (tree parms,
           /* Store this argument.  */
           if (arg == error_mark_node)
             lost++;
+         if (lost)
+           break;
           TREE_VEC_ELT (new_inner_args, parm_idx) = arg;
 
          /* We are done with all of the arguments.  */
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic150.C b/gcc/testsuite/g++.dg/cpp0x/variadic150.C
new file mode 100644 (file)
index 0000000..6a30efe
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/60219
+// { dg-require-effective-target c++11 }
+
+template<typename..., int> void foo();
+
+void bar()
+{
+  foo<0>;                      // { dg-error "" }
+}