This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11952] REGRESSION: friend declaration handled as function call concerning access.
- From: "victor dot judin at materna dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Aug 2004 09:01:49 -0000
- Subject: [Bug c++/11952] REGRESSION: friend declaration handled as function call concerning access.
- References: <20030816225616.11952.carlo@alinoe.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From victor dot judin at materna dot de 2004-08-27 09:01 -------
(In reply to comment #1)
> Sorry,... this is not a bug it seems.
>
> According to the standard [class.friend] 11.4 Friends
> 7 A name nominated by a friend declaration shall be accessible in the scope of
> the class containing the friend declaration. The meaning of the friend
> declaration is the same whether the friend declaration appears in the private,
> protected or public (9.2) portion of the class member-specification.
Sorry, that's totally idiotic.
If I have
class A
{
void f();
public:
A();
~A();
};
and
class B
{
//...
friend class A();
};
the visibility of A::f() remains private.
The sentence you mentioned above applies to the access of B's members from A and
is NOT about the access of A's members from B!!!
The sentence
>The meaning of the friend declaration is the same whether the friend
>declaration appears in the
>private, protected or public (9.2) portion of the class memberspecification.
means that the place where the declaration of friend ccurs is of no importance -
be it in public, private or proteced section of the class.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11952