re PR c++/35242 (ICE with invalid specialization of variadic template)
authorPaolo Carlini <paolo.carlini@oracle.com>
Sun, 8 Jun 2008 21:25:49 +0000 (21:25 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 8 Jun 2008 21:25:49 +0000 (21:25 +0000)
/cp
2008-06-08  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/35242
        * pt.c (maybe_process_partial_specialization): Check the tree
returned by push_template_decl for error_mark_node.
* parser.c (cp_parser_class_head): Likewise, check the tree
returned by the latter.

/testsuite
2008-06-08  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/35242
        * g++.dg/cpp0x/vt-35242.C: New.

From-SVN: r136569

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

index fb79f4770c51a42988ca2a9b81d09b990a989807..74ae4ae4d98d9a82891a243d3403361104d1f272 100644 (file)
@@ -1,3 +1,11 @@
+2008-06-08  Paolo Carlini  <paolo.carlini@oracle.com>
+
+        PR c++/35242
+        * pt.c (maybe_process_partial_specialization): Check the tree
+       returned by push_template_decl for error_mark_node.
+       * parser.c (cp_parser_class_head): Likewise, check the tree
+       returned by the latter. 
+
 2008-06-07  Paolo Carlini  <paolo.carlini@oracle.com>
 
         PR c++/35327
index 5ca1bd7e5334dfa49543c3e220f9ca2eb9bebfd1..12d1a2d8ad98f81208828df74e58d4387ced34e1 100644 (file)
@@ -14832,7 +14832,13 @@ cp_parser_class_head (cp_parser* parser,
            }
        }
 
-      maybe_process_partial_specialization (TREE_TYPE (type));
+      if (maybe_process_partial_specialization (TREE_TYPE (type))
+         == error_mark_node)
+       {
+         type = NULL_TREE;
+         goto done;
+       }
+
       class_type = current_class_type;
       /* Enter the scope indicated by the nested-name-specifier.  */
       pushed_scope = push_scope (nested_name_specifier);
index f141b74a6fd4594ac9b175f72dcf610e8e812831..eb4a7b7ed34bd69fcafe5f94e180d1b9c026d3c9 100644 (file)
@@ -772,7 +772,11 @@ maybe_process_partial_specialization (tree type)
          check_specialization_namespace (CLASSTYPE_TI_TEMPLATE (type));
          SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (type);
          if (processing_template_decl)
-           push_template_decl (TYPE_MAIN_DECL (type));
+           {
+             if (push_template_decl (TYPE_MAIN_DECL (type))
+                 == error_mark_node)
+               return error_mark_node;
+           }
        }
       else if (CLASSTYPE_TEMPLATE_INSTANTIATION (type))
        error ("specialization of %qT after instantiation", type);
index 84ee84ca0a9324f2557696506992966a6c282b9a..ee3af09b7142c5a3fde2b6c2655211fe4c6fe362 100644 (file)
@@ -1,3 +1,8 @@
+2008-06-08  Paolo Carlini  <paolo.carlini@oracle.com>
+
+        PR c++/35242
+        * g++.dg/cpp0x/vt-35242.C: New.
+
 2008-06-08  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/36459
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-35242.C b/gcc/testsuite/g++.dg/cpp0x/vt-35242.C
new file mode 100644 (file)
index 0000000..9cc859b
--- /dev/null
@@ -0,0 +1,7 @@
+// { dg-options "-std=c++0x" }
+struct A
+{
+  template<typename... T> struct B;
+};
+
+template<typename... T> struct A::B<T*> {}; // { dg-error "parameter packs|T" }