This is the mail archive of the gcc-help@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]

Re: Befriending a private member function


"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


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