diff options
| author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-19 04:56:45 +0000 |
|---|---|---|
| committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-19 04:56:45 +0000 |
| commit | 0cd69b170c537b551fd04f5491c04ed4d4c58540 (patch) | |
| tree | 7fea522200428b59794c12580af53bd15eb4ead2 | |
| parent | cfec09754a50791c41659e12ca82cbf408c99e0f (diff) | |
| download | ppe42-gcc-0cd69b170c537b551fd04f5491c04ed4d4c58540.tar.gz ppe42-gcc-0cd69b170c537b551fd04f5491c04ed4d4c58540.zip | |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37555 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/cp/decl.c | 88 | ||||
| -rw-r--r-- | gcc/cp/mangle.c | 3 |
3 files changed, 54 insertions, 42 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 93b1689b423..0fb019deda4 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 fe964ea40fc..d6419303c2c 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 5c45a9137f1..7353cf881ad 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; |

