decl.c (grokdeclarator): Improve diagnostic for friend declarations of class members.
* decl.c (grokdeclarator): Improve diagnostic for friend declarations of class members. * g++.dg/other/friend4.C: New test. From-SVN: r109017
This commit is contained in:
parent
41e8659ef1
commit
59e7c84ca1
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
|
@ -7609,8 +7609,13 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -8183,7 +8188,7 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
{
|
||||
/* 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)
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2005-12-23 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
|
||||
|
||||
* g++.dg/other/friend4.C: New test.
|
||||
|
||||
2005-12-23 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/25005
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// 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" }
|
||||
};
|
Loading…
Reference in New Issue