re PR c++/22293 (ICE declaring destructor as friend)
PR c++/22293 * decl.c (grokdeclarator): Reject unqualified destructors in friend declarations. * g++.dg/other/friend3.C: New test. From-SVN: r105564
This commit is contained in:
parent
685e39c289
commit
6d2989e117
|
@ -1,3 +1,9 @@
|
|||
2005-10-18 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
|
||||
|
||||
PR c++/22293
|
||||
* decl.c (grokdeclarator): Reject unqualified destructors in
|
||||
friend declarations.
|
||||
|
||||
2005-10-18 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/23293
|
||||
|
|
|
@ -8021,15 +8021,25 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
}
|
||||
|
||||
/* Check that the name used for a destructor makes sense. */
|
||||
if (sfk == sfk_destructor
|
||||
&& !same_type_p (TREE_OPERAND
|
||||
(id_declarator->u.id.unqualified_name, 0),
|
||||
ctype))
|
||||
if (sfk == sfk_destructor)
|
||||
{
|
||||
error ("declaration of %qD as member of %qT",
|
||||
id_declarator->u.id.unqualified_name,
|
||||
ctype);
|
||||
return error_mark_node;
|
||||
if (!ctype)
|
||||
{
|
||||
gcc_assert (friendp);
|
||||
error ("expected qualified name in friend declaration "
|
||||
"for destructor %qD",
|
||||
id_declarator->u.id.unqualified_name);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
if (!same_type_p (TREE_OPERAND
|
||||
(id_declarator->u.id.unqualified_name, 0),
|
||||
ctype))
|
||||
{
|
||||
error ("declaration of %qD as member of %qT",
|
||||
id_declarator->u.id.unqualified_name, ctype);
|
||||
return error_mark_node;
|
||||
}
|
||||
}
|
||||
|
||||
/* Tell grokfndecl if it needs to set TREE_PUBLIC on the node. */
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2005-10-18 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
|
||||
|
||||
PR c++/22293
|
||||
* g++.dg/other/friend3.C: New test.
|
||||
|
||||
2005-10-18 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/23293
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// PR c++/22293
|
||||
// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
|
||||
// { dg-do compile }
|
||||
|
||||
struct A
|
||||
{
|
||||
friend ~A(); // { dg-error "qualified name" }
|
||||
};
|
||||
|
||||
struct B
|
||||
{
|
||||
friend ~A(); // { dg-error "qualified name" }
|
||||
};
|
Loading…
Reference in New Issue