]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/31441 (ICE with variadic template and specialization)
authorPaolo Carlini <pcarlini@suse.de>
Thu, 11 Oct 2007 09:39:41 +0000 (09:39 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 11 Oct 2007 09:39:41 +0000 (09:39 +0000)
/testsuite
2007-10-11  Paolo Carlini  <pcarlini@suse.de>

PR c++/31441
* g++.dg/cpp0x/variadic83.C: New.

/cp
2007-10-11  Paolo Carlini  <pcarlini@suse.de>

PR c++/33461
* pt.c (coerce_template_parameter_pack): Do not pass error_mark_node
to convert_template_argument.
(coerce_template_parms): Return error_mark_node after fixed-length
error.
(tsubst_decl): Check for error_mark_node the return value of the
first tsubst in 'case VAR_DECL'.

/testsuite
2007-10-11  Paolo Carlini  <pcarlini@suse.de>

PR c++/33461
* g++.dg/cpp0x/variadic81.C: New.
* g++.dg/cpp0x/variadic82.C: Likewise.

From-SVN: r129229

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

index 4f737229412458bfa231f3aca6133ccca8f49acc..1aeacba8b96cbc4da4073d94bd6744a1fb3e71dc 100644 (file)
@@ -1,3 +1,13 @@
+2007-10-11  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33461
+       * pt.c (coerce_template_parameter_pack): Do not pass error_mark_node
+       to convert_template_argument.
+       (coerce_template_parms): Return error_mark_node after fixed-length
+       error.
+       (tsubst_decl): Check for error_mark_node the return value of the
+       first tsubst in 'case VAR_DECL'.
+
 2007-10-08  Ollie Wild  <aaw@google.com>
 
        * typeck2.c (digest_init): Call cplus_expand_constant after
index 5b07c7027a7a1cee1dc9547433d60a10202b6df4..fe2a739d40c2a5c4c03f280b60547188f29700cd 100644 (file)
@@ -4933,9 +4933,10 @@ coerce_template_parameter_pack (tree parms,
             TREE_VEC_ELT (packed_types, arg_idx - parm_idx);
         }
 
-      arg = convert_template_argument (actual_parm, 
-                                       arg, new_args, complain, parm_idx,
-                                       in_decl);
+      if (arg != error_mark_node)
+       arg = convert_template_argument (actual_parm, 
+                                        arg, new_args, complain, parm_idx,
+                                        in_decl);
       if (arg == error_mark_node)
         (*lost)++;
       TREE_VEC_ELT (packed_args, arg_idx - parm_idx) = arg; 
@@ -5086,6 +5087,7 @@ coerce_template_parms (tree parms,
               else
                 error ("cannot expand %<%T%> into a fixed-length "
                        "argument list", arg);
+             return error_mark_node;
             }
         }
       else if (require_all_args)
@@ -8087,6 +8089,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
               TYPE_NAME is not correct for the above test if
               we've copied the type for a typedef.  */
            type = tsubst (TREE_TYPE (t), args, complain, in_decl);
+           if (type == error_mark_node)
+             return error_mark_node;
            r = TYPE_NAME (type);
            break;
          }
index efb4ca4f8ec6d8292cd47381c3382cc9b2128a24..5129625c1634b9abdbdc25a80269277ea6483697 100644 (file)
@@ -1,3 +1,14 @@
+2007-10-11  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/31441
+       * g++.dg/cpp0x/variadic83.C: New.
+
+2007-10-11  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33461
+       * g++.dg/cpp0x/variadic81.C: New.
+       * g++.dg/cpp0x/variadic82.C: Likewise.
+
 2007-10-11  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/33724
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic81.C b/gcc/testsuite/g++.dg/cpp0x/variadic81.C
new file mode 100644 (file)
index 0000000..d710128
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/33461
+// { dg-options "-std=gnu++0x" }
+
+template<typename> struct A;
+
+template<typename... T> struct A<T*>  // { dg-error "not expanded|note" }
+{                                     // { dg-error "not expanded|note" }
+  struct B;
+};
+
+A<void*> a;
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic82.C b/gcc/testsuite/g++.dg/cpp0x/variadic82.C
new file mode 100644 (file)
index 0000000..5acbc83
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/33461
+// { dg-options "-std=gnu++0x" }
+
+template<typename> struct A;
+
+template<typename... T> struct A<T*...> // { dg-error "cannot expand" }
+{
+  struct B;
+};
+
+A<void*> a; // { dg-error "incomplete type" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic83.C b/gcc/testsuite/g++.dg/cpp0x/variadic83.C
new file mode 100644 (file)
index 0000000..ec6cabd
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/31441
+// { dg-options "-std=gnu++0x" }
+
+template<typename> struct A;
+
+template<typename... T> struct A<T...> { }; // { dg-error "cannot expand" }
+
+A<int> a; // { dg-error "incomplete type" }