diff options
author | Jason Merrill <jason@redhat.com> | 2009-02-20 00:32:40 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-02-20 00:32:40 -0500 |
commit | bd967b22bc9acbf5c77a1a75fc6df199637f55e3 (patch) | |
tree | ed6eb970c354821a33148d0612bba987c7776597 /gcc/cp/decl.c | |
parent | 97eb6215db4b11bba6857d69a587cc49e7f26760 (diff) | |
download | gcc-bd967b22bc9acbf5c77a1a75fc6df199637f55e3.zip gcc-bd967b22bc9acbf5c77a1a75fc6df199637f55e3.tar.gz gcc-bd967b22bc9acbf5c77a1a75fc6df199637f55e3.tar.bz2 |
re PR c++/39225 (ICE if destructor doen't match class name)
PR c++/39225
* decl.c (grokdeclarator): Handle ~identifier.
From-SVN: r144314
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 930f944..551764d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7659,7 +7659,9 @@ grokdeclarator (const cp_declarator *declarator, } type = TREE_OPERAND (decl, 0); - name = IDENTIFIER_POINTER (constructor_name (type)); + if (TYPE_P (type)) + type = constructor_name (type); + name = IDENTIFIER_POINTER (type); dname = decl; } break; @@ -8161,8 +8163,9 @@ grokdeclarator (const cp_declarator *declarator, switch (TREE_CODE (unqualified_id)) { case BIT_NOT_EXPR: - unqualified_id - = constructor_name (TREE_OPERAND (unqualified_id, 0)); + unqualified_id = TREE_OPERAND (unqualified_id, 0); + if (TYPE_P (unqualified_id)) + unqualified_id = constructor_name (unqualified_id); break; case IDENTIFIER_NODE: @@ -9038,21 +9041,20 @@ grokdeclarator (const cp_declarator *declarator, /* Check that the name used for a destructor makes sense. */ if (sfk == sfk_destructor) { + tree uqname = id_declarator->u.id.unqualified_name; + if (!ctype) { gcc_assert (friendp); error ("expected qualified name in friend declaration " - "for destructor %qD", - id_declarator->u.id.unqualified_name); + "for destructor %qD", uqname); return error_mark_node; } - if (!same_type_p (TREE_OPERAND - (id_declarator->u.id.unqualified_name, 0), - ctype)) + if (!check_dtor_name (ctype, TREE_OPERAND (uqname, 0))) { error ("declaration of %qD as member of %qT", - id_declarator->u.id.unqualified_name, ctype); + uqname, ctype); return error_mark_node; } } |