+2005-12-23 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ * decl.c (grokdeclarator): Improve diagnostic for friend
+ declarations of class members.
+
2005-12-22 Mark Mitchell <mark@codesourcery.com>
PR c++/25369
}
if (ctype == current_class_type)
- pedwarn ("extra qualification %<%T::%> on member %qs",
- ctype, name);
+ {
+ if (friendp)
+ pedwarn ("member functions are implicitly friends of their class");
+ else
+ pedwarn ("extra qualification %<%T::%> on member %qs",
+ ctype, name);
+ }
else if (TREE_CODE (type) == FUNCTION_TYPE)
{
tree sname = declarator->u.id.unqualified_name;
{
/* Friends are treated specially. */
if (ctype == current_class_type)
- warning (0, "member functions are implicitly friends of their class");
+ ; /* We already issued a pedwarn. */
else if (decl && DECL_NAME (decl))
{
if (template_class_depth (current_class_type) == 0)
--- /dev/null
+// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+// Misleading diagnostic
+
+struct A
+{
+ friend void A::foo(); // { dg-error "implicitly friends" }
+ friend A::~A(); // { dg-error "implicitly friends" }
+};