re PR c++/47220 ([C++0x] no error on unterminated template argument list for variadic...
authorJason Merrill <jason@redhat.com>
Mon, 16 Apr 2012 03:18:17 +0000 (23:18 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 16 Apr 2012 03:18:17 +0000 (23:18 -0400)
PR c++/47220
* pt.c (coerce_template_parameter_pack): Check for error_mark_node.

From-SVN: r186480

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr39639.C
gcc/testsuite/g++.dg/cpp0x/variadic126.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/pr52260.C

index d37d42c02640ea219d2c5f462156ac7b9f83f820..893ce5639a910ede3002c75266ec8680fe82656d 100644 (file)
@@ -1,5 +1,8 @@
 2012-04-15  Jason Merrill  <jason@redhat.com>
 
+       PR c++/47220
+       * pt.c (coerce_template_parameter_pack): Check for error_mark_node.
+
        PR c++/52292
        PR c++/52380
        * pt.c (coerce_template_parms): Even if we aren't converting we
index 42dc0a74439376f186ff3b745d9abe0108782488..95d0aba0534ce6234c2638ccdb159d52d6848aaa 100644 (file)
@@ -6697,7 +6697,12 @@ coerce_template_parameter_pack (tree parms,
             TREE_VEC_ELT (packed_types, arg_idx - parm_idx);
         }
 
-      if (arg != error_mark_node)
+      if (arg == error_mark_node)
+       {
+         if (complain & tf_error)
+           error ("template argument %d is invalid", arg_idx + 1);
+       }
+      else
        arg = convert_template_argument (actual_parm, 
                                         arg, new_args, complain, parm_idx,
                                         in_decl);
index a936b368ce0046a0a991353f60e5740d834a3432..321adb379c41a98ad415e8a1497d279e1f189800 100644 (file)
@@ -1,5 +1,8 @@
 2012-04-15  Jason Merrill  <jason@redhat.com>
 
+       PR c++/47220
+       * g++.dg/cpp0x/variadic126.C: New.
+
        PR c++/52380
        * g++.dg/cpp0x/variadic125.C: New.
 
index 4fd8b56fd30c4f2f0a309e40a16eb98ac872fe05..0838a0ba25f318f8377bb81de36d7e8191257ddf 100644 (file)
@@ -2,6 +2,7 @@
 // Origin: PR c++/39639
 // { dg-do compile }
 // { dg-options "-std=c++0x" }
+// { dg-prune-output "template argument 1 is invalid" }
 
 template <class... Types>
 struct S
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic126.C b/gcc/testsuite/g++.dg/cpp0x/variadic126.C
new file mode 100644 (file)
index 0000000..513c7e5
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/47220
+// { dg-do compile { target c++11 } }
+
+template < typename ... > struct A;
+
+struct B : A <                 // { dg-error "invalid" }
+{
+};
index 9ab2589ce116191d47400759cb39a31d0ca0d3a0..024afc8bc542aae4f90cbd79be88d2d97f04d3e2 100644 (file)
@@ -22,7 +22,7 @@ namespace A
 {
   template <typename T>
   struct I : H <T> {};
-  template <typename ...> struct J;
+  template <typename ...> struct J {};
   template <typename> struct K;
   struct L
   {
@@ -36,7 +36,7 @@ namespace A
   template <typename T, typename B2, typename ... B4>
   struct N <T (B4 ...), B2> : L::M <B2> {};
   template <typename T, typename ... B4>
-  struct K <T (B4 ...)> :J <,>, L
+  struct K <T (B4 ...)> :J <>, L
   {
     typedef T O (B4 ...);
     struct P {};