diff options
author | Volker Reichelt <reichelt@igpm.rwth-aachen.de> | 2006-01-24 11:55:58 +0000 |
---|---|---|
committer | Volker Reichelt <reichelt@gcc.gnu.org> | 2006-01-24 11:55:58 +0000 |
commit | 1b3d28a8b96cd5ecab2e3c5c9c2a6a9f4dc67fd6 (patch) | |
tree | adceb6c58da099960f7ae0c1c45bb7f25c9ea8b7 /gcc/cp/call.c | |
parent | c05849f4978e1b70d9b5ce97a8843321b8dc0c7e (diff) | |
download | gcc-1b3d28a8b96cd5ecab2e3c5c9c2a6a9f4dc67fd6.zip gcc-1b3d28a8b96cd5ecab2e3c5c9c2a6a9f4dc67fd6.tar.gz gcc-1b3d28a8b96cd5ecab2e3c5c9c2a6a9f4dc67fd6.tar.bz2 |
re PR c++/25552 (Invalid destructor name accepted in friend declaration)
PR c++/25552
* parser.c (cp_parser_unqualified_id): Check that destructor name
and scope match.
* call.c (check_dtor_name): Do not expect a BIT_NOT_EXPR.
Adjust comment. Return early if possible.
Use same_type_p to compare types.
* typeck.c (lookup_destructor): Adjust call to check_dtor_name.
* g++.dg/parse/dtor8.C: New test.
From-SVN: r110168
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 0c23caa..7900176 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -198,15 +198,12 @@ typedef void (*diagnostic_fn_t) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2); static tree build_temp (tree, tree, int, diagnostic_fn_t *); static void check_constructor_callable (tree, tree); -/* Returns nonzero iff the destructor name specified in NAME - (a BIT_NOT_EXPR) matches BASETYPE. The operand of NAME can take many - forms... */ +/* Returns nonzero iff the destructor name specified in NAME matches BASETYPE. + NAME can take many forms... */ bool check_dtor_name (tree basetype, tree name) { - name = TREE_OPERAND (name, 0); - /* Just accept something we've already complained about. */ if (name == error_mark_node) return true; @@ -220,7 +217,7 @@ check_dtor_name (tree basetype, tree name) if ((IS_AGGR_TYPE (basetype) && name == constructor_name (basetype)) || (TREE_CODE (basetype) == ENUMERAL_TYPE && name == TYPE_IDENTIFIER (basetype))) - name = basetype; + return true; else name = get_type_value (name); } @@ -237,9 +234,9 @@ check_dtor_name (tree basetype, tree name) return false; } - if (name && TYPE_MAIN_VARIANT (basetype) == TYPE_MAIN_VARIANT (name)) - return true; - return false; + if (!name) + return false; + return same_type_p (TYPE_MAIN_VARIANT (basetype), TYPE_MAIN_VARIANT (name)); } /* We want the address of a function or method. We avoid creating a |