+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
}
/* 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. */
--- /dev/null
+// 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" }
+};