From ee996e9e57af9f194a3c5678729283a3d2aaf66b Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 6 Dec 1998 01:33:10 +0000 Subject: [PATCH] decl2.c (coerce_new_type): Use same_type_p. * decl2.c (coerce_new_type): Use same_type_p. (coerce_delete_type): Likewise. * call.c (check_dtor_name): Return 1, not error_mark_node. From-SVN: r24122 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/call.c | 3 ++- gcc/cp/decl2.c | 10 ++++------ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8bdd55366a0..fa87972bfe7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +1998-12-05 Jason Merrill + + * decl2.c (coerce_new_type): Use same_type_p. + (coerce_delete_type): Likewise. + + * call.c (check_dtor_name): Return 1, not error_mark_node. + 1998-12-04 Jason Merrill * lex.c (handle_cp_pragma): Disable #pragma interface/implementation diff --git a/gcc/cp/call.c b/gcc/cp/call.c index cfc94fa67f3..ea8874532ce 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -347,8 +347,9 @@ check_dtor_name (basetype, name) { name = TREE_OPERAND (name, 0); + /* Just accept something we've already complained about. */ if (name == error_mark_node) - return error_mark_node; + return 1; if (TREE_CODE (name) == TYPE_DECL) name = TREE_TYPE (name); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 3bcc08dc9f9..f2ba726efab 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2285,15 +2285,14 @@ coerce_new_type (type) if (TREE_CODE (type) == METHOD_TYPE) type = build_function_type (TREE_TYPE (type), TREE_CHAIN (TYPE_ARG_TYPES (type))); - if (TREE_TYPE (type) != ptr_type_node) + if (! same_type_p (TREE_TYPE (type), ptr_type_node)) e1 = 1, error ("`operator new' must return type `void *'"); /* Technically the type must be `size_t', but we may not know what that is. */ if (TYPE_ARG_TYPES (type) == NULL_TREE) e1 = 1, error ("`operator new' takes type `size_t' parameter"); - else if (TREE_CODE (TREE_VALUE (TYPE_ARG_TYPES (type))) != INTEGER_TYPE - || TYPE_PRECISION (TREE_VALUE (TYPE_ARG_TYPES (type))) != TYPE_PRECISION (sizetype)) + else if (! same_type_p (TREE_VALUE (TYPE_ARG_TYPES (type)), sizetype)) e2 = 1, error ("`operator new' takes type `size_t' as first parameter"); if (e2) type = build_function_type (ptr_type_node, tree_cons (NULL_TREE, sizetype, TREE_CHAIN (TYPE_ARG_TYPES (type)))); @@ -2322,7 +2321,7 @@ coerce_delete_type (type) e1 = 1, error ("`operator delete' must return type `void'"); if (arg_types == NULL_TREE - || TREE_VALUE (arg_types) != ptr_type_node) + || ! same_type_p (TREE_VALUE (arg_types), ptr_type_node)) e2 = 1, error ("`operator delete' takes type `void *' as first parameter"); #if 0 @@ -2333,8 +2332,7 @@ coerce_delete_type (type) /* Again, technically this argument must be `size_t', but again we may not know what that is. */ tree t2 = TREE_VALUE (TREE_CHAIN (arg_types)); - if (TREE_CODE (t2) != INTEGER_TYPE - || TYPE_PRECISION (t2) != TYPE_PRECISION (sizetype)) + if (! same_type_p (t2, sizetype)) e3 = 1, error ("second argument to `operator delete' must be of type `size_t'"); else if (TREE_CHAIN (TREE_CHAIN (arg_types)) != void_list_node) { -- 2.30.2