Commit bd967b22 by Jason Merrill Committed by Jason Merrill

re PR c++/39225 (ICE if destructor doen't match class name)

        PR c++/39225
        * decl.c (grokdeclarator): Handle ~identifier.

From-SVN: r144314
parent 97eb6215
2009-02-20 Jason Merrill <jason@redhat.com>
PR c++/39225
* decl.c (grokdeclarator): Handle ~identifier.
2009-02-19 Jakub Jelinek <jakub@redhat.com> 2009-02-19 Jakub Jelinek <jakub@redhat.com>
PR target/39175 PR target/39175
......
...@@ -7659,7 +7659,9 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7659,7 +7659,9 @@ grokdeclarator (const cp_declarator *declarator,
} }
type = TREE_OPERAND (decl, 0); 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; dname = decl;
} }
break; break;
...@@ -8161,8 +8163,9 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -8161,8 +8163,9 @@ grokdeclarator (const cp_declarator *declarator,
switch (TREE_CODE (unqualified_id)) switch (TREE_CODE (unqualified_id))
{ {
case BIT_NOT_EXPR: case BIT_NOT_EXPR:
unqualified_id unqualified_id = TREE_OPERAND (unqualified_id, 0);
= constructor_name (TREE_OPERAND (unqualified_id, 0)); if (TYPE_P (unqualified_id))
unqualified_id = constructor_name (unqualified_id);
break; break;
case IDENTIFIER_NODE: case IDENTIFIER_NODE:
...@@ -9038,21 +9041,20 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -9038,21 +9041,20 @@ grokdeclarator (const cp_declarator *declarator,
/* Check that the name used for a destructor makes sense. */ /* Check that the name used for a destructor makes sense. */
if (sfk == sfk_destructor) if (sfk == sfk_destructor)
{ {
tree uqname = id_declarator->u.id.unqualified_name;
if (!ctype) if (!ctype)
{ {
gcc_assert (friendp); gcc_assert (friendp);
error ("expected qualified name in friend declaration " error ("expected qualified name in friend declaration "
"for destructor %qD", "for destructor %qD", uqname);
id_declarator->u.id.unqualified_name);
return error_mark_node; return error_mark_node;
} }
if (!same_type_p (TREE_OPERAND if (!check_dtor_name (ctype, TREE_OPERAND (uqname, 0)))
(id_declarator->u.id.unqualified_name, 0),
ctype))
{ {
error ("declaration of %qD as member of %qT", error ("declaration of %qD as member of %qT",
id_declarator->u.id.unqualified_name, ctype); uqname, ctype);
return error_mark_node; return error_mark_node;
} }
} }
......
2009-02-20 Jason Merrill <jason@redhat.com>
PR c++/39225
* g++.dg/parse/dtor15.C: New test.
2009-02-19 Kazu Hirata <kazu@codesourcery.com> 2009-02-19 Kazu Hirata <kazu@codesourcery.com>
* gcc.c-torture/execute/20090219-1.c: New. * gcc.c-torture/execute/20090219-1.c: New.
...@@ -68,6 +73,9 @@ ...@@ -68,6 +73,9 @@
2009-02-18 Jason Merrill <jason@redhat.com> 2009-02-18 Jason Merrill <jason@redhat.com>
PR c++/38880
* g++.dg/init/const7.C: Remove XFAIL.
PR target/39179 PR target/39179
* g++.dg/opt/const6.C: New test. * g++.dg/opt/const6.C: New test.
......
// PR c++/39225
template <class T>
class A
{
public:
A() {}
~B() {} // { dg-error "~B" }
};
int main()
{
A<int> *a = new A<int>;
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment