aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2000-11-19 04:56:45 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-11-19 04:56:45 +0000
commit04f3dc2b0376338313d08a596c9d609375843d20 (patch)
tree7fea522200428b59794c12580af53bd15eb4ead2 /gcc/cp
parentb35431cf0745e4f775964ac12097f1a2c545862e (diff)
downloadgcc-04f3dc2b0376338313d08a596c9d609375843d20.zip
gcc-04f3dc2b0376338313d08a596c9d609375843d20.tar.gz
gcc-04f3dc2b0376338313d08a596c9d609375843d20.tar.bz2
decl.c (grokparms): Don't even function types of `void' type, either.
* 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
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c88
-rw-r--r--gcc/cp/mangle.c3
3 files changed, 54 insertions, 42 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 93b1689..0fb019d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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>
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index fe964ea..d641930 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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;
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 5c45a91..7353cf8 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1245,6 +1245,9 @@ write_type (type)
MANGLE_TRACE_TREE ("type", type);
+ if (type == error_mark_node)
+ return;
+
if (find_substitution (type))
return;