This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/52212] friend declaration doesn't see previous friend of same function


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52212

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-12 15:08:14 UTC ---
(In reply to comment #0)
> Note that the same function was earlier made a friend of class E, and so can
> see F. If you leave out the second friending, you get:
>  foo.cc: In function Ãvoid foo1(D::E::F&)Ã:
>  foo.cc:2:8: error: Ãclass D::EÃ is private
>  foo.cc:9:21: error: within this context
> which is correct; foo1 cannot see E without the second friend. But with both
> friends foo1 should see everybody.

Just to be clear, the problem is not that foo can't access the names, it's that
the second declaration of foo appears in the scope of class D, and D cannot
access the name D::E::F so you can't even declare foo there.  Adding the extra
friend decl allows foo to be declared there.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]