This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Befriending a private member function
- From: Ian Lance Taylor <iant at google dot com>
- To: Herwig, BjÃrn <herwig at gdsys dot de>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Wed, 06 May 2009 07:29:45 -0700
- Subject: Re: Befriending a private member function
- References: <48D3D52125C49B43AE880038E2E5314B0247C2@SRV101.gdsys.de>
"Herwig, BjÃrn" <herwig@gdsys.de> writes:
> I recently came across a rather historic piece of C++ code once written for G++ 3 point
> something. It doesn't compile with a G++ 4, as it tries to befriend a private member
> function. Okay, this is easily solved by befriending the whole class, but I am really
> curious now, why this isn't allowed anymore.
>
> I've read the corresponding sections in "The C++ Programming Language, Special Edition"
> and section 11.4 of the C++ 2003 standard, but that still left me clueless.
>
> Could anybody give me a hint?
ISO C++98 [friend.class] paragraph 7:
A name nominated by a friend declaration shall be accessible in the
scope of the class containing the friend declaration.
Ian