]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl.c (grokparms): Don't even function types of `void' type, either.
authorMark Mitchell <mark@codesourcery.com>
Sun, 19 Nov 2000 04:56:45 +0000 (04:56 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 19 Nov 2000 04:56:45 +0000 (04:56 +0000)
* decl.c (grokparms): Don't even function types of `void' type,
either.
* mangle.c (write_type): Don't crash when confronted with the
error_mark_node.

From-SVN: r37555

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/mangle.c

index 93b1689b4238dce54778d28450f3b8c2b38ff8f3..0fb019deda48eb1334b94a6156c91b01917aeeda 100644 (file)
@@ -1,5 +1,10 @@
 2000-11-18  Mark Mitchell  <mark@codesourcery.com>
 
+       * decl.c (grokparms): Don't even function types of `void' type,
+       either.
+       * mangle.c (write_type): Don't crash when confronted with the
+       error_mark_node.
+
        * decl.c (grokparms): Don't create parameters of `void' type.
 
 2000-11-17  Zack Weinberg  <zack@wolery.stanford.edu>
index fe964ea40fcb57010b8195efe2f4c412e2c7102e..d6419303c2ca4804dcf3f81c60fffa2d95dadfb5 100644 (file)
@@ -12025,51 +12025,55 @@ grokparms (first_parm)
          /* It's not a good idea to actually create parameters of
             type `void'; other parts of the compiler assume that a
             void type terminates the parameter list.  */
+         type = error_mark_node;
          TREE_TYPE (decl) = error_mark_node;
         }
-      
-      /* Top-level qualifiers on the parameters are
-         ignored for function types.  */
-      type = TYPE_MAIN_VARIANT (type);
-      if (TREE_CODE (type) == METHOD_TYPE)
-        {
-          cp_error ("parameter `%D' invalidly declared method type", decl);
-          type = build_pointer_type (type);
-          TREE_TYPE (decl) = type;
-        }
-      else if (TREE_CODE (type) == OFFSET_TYPE)
-        {
-          cp_error ("parameter `%D' invalidly declared offset type", decl);
-          type = build_pointer_type (type);
-          TREE_TYPE (decl) = type;
-        }
-      else if (abstract_virtuals_error (decl, type))
-        any_error = 1;  /* Seems like a good idea. */
-      else if (POINTER_TYPE_P (type))
-        {
-          /* [dcl.fct]/6, parameter types cannot contain pointers (references)
-             to arrays of unknown bound.  */
-          tree t = type;
-          
-          while (POINTER_TYPE_P (t)
-                 || (TREE_CODE (t) == ARRAY_TYPE
-                     && TYPE_DOMAIN (t) != NULL_TREE))
-           t = TREE_TYPE (t);
-          if (TREE_CODE (t) == ARRAY_TYPE)
-           cp_error ("parameter `%D' includes %s to array of unknown bound `%T'",
-                     decl, TYPE_PTR_P (type) ? "pointer" : "reference", t);
-        }
 
-      DECL_ARG_TYPE (decl) = TREE_TYPE (decl);
-      if (PROMOTE_PROTOTYPES
-         && (TREE_CODE (type) == INTEGER_TYPE
-             || TREE_CODE (type) == ENUMERAL_TYPE)
-         && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
-       DECL_ARG_TYPE (decl) = integer_type_node;
-      if (!any_error && init)
-        init = check_default_argument (decl, init);
-      else
-       init = NULL_TREE;
+      if (type != error_mark_node) 
+       {
+         /* Top-level qualifiers on the parameters are
+            ignored for function types.  */
+         type = TYPE_MAIN_VARIANT (type);
+         if (TREE_CODE (type) == METHOD_TYPE)
+           {
+             cp_error ("parameter `%D' invalidly declared method type", decl);
+             type = build_pointer_type (type);
+             TREE_TYPE (decl) = type;
+           }
+         else if (TREE_CODE (type) == OFFSET_TYPE)
+           {
+             cp_error ("parameter `%D' invalidly declared offset type", decl);
+             type = build_pointer_type (type);
+             TREE_TYPE (decl) = type;
+           }
+         else if (abstract_virtuals_error (decl, type))
+           any_error = 1;  /* Seems like a good idea. */
+         else if (POINTER_TYPE_P (type))
+           {
+             /* [dcl.fct]/6, parameter types cannot contain pointers
+                (references) to arrays of unknown bound.  */
+             tree t = type;
+
+             while (POINTER_TYPE_P (t)
+                    || (TREE_CODE (t) == ARRAY_TYPE
+                        && TYPE_DOMAIN (t) != NULL_TREE))
+               t = TREE_TYPE (t);
+             if (TREE_CODE (t) == ARRAY_TYPE)
+               cp_error ("parameter `%D' includes %s to array of unknown bound `%T'",
+                         decl, TYPE_PTR_P (type) ? "pointer" : "reference", t);
+           }
+
+         DECL_ARG_TYPE (decl) = TREE_TYPE (decl);
+         if (PROMOTE_PROTOTYPES
+             && (TREE_CODE (type) == INTEGER_TYPE
+                 || TREE_CODE (type) == ENUMERAL_TYPE)
+             && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
+           DECL_ARG_TYPE (decl) = integer_type_node;
+         if (!any_error && init)
+           init = check_default_argument (decl, init);
+         else
+           init = NULL_TREE;
+       }
 
       TREE_CHAIN (decl) = decls;
       decls = decl;
index 5c45a9137f1ce05a9fbefe3ea490772f6f57a172..7353cf881ad2f32ca0b1ab18e79143a9d961c14d 100644 (file)
@@ -1245,6 +1245,9 @@ write_type (type)
 
   MANGLE_TRACE_TREE ("type", type);
 
+  if (type == error_mark_node)
+    return;
+
   if (find_substitution (type))
     return;