Commit 6d2989e1 by Volker Reichelt Committed by Volker Reichelt

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
parent 685e39c2
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. */
......
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
// 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" }
};
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