C++ language lawyer question

Mike Stump mrs@apple.com
Tue Sep 30 02:15:00 GMT 2003


On Monday, September 29, 2003, at 04:29 PM, Bruce Stephens wrote:
> Gerald Pfeifer <gerald@pfeifer.com> writes:
>
> [...]
>
>> ...and if the "invited" friend is a member of a class, it must not
>> be private or protected.  This is the difference between GCC 3.3 and
>> 3.4.
>
> Ah, I see.  Interesting question: can one bestow friendship on a
> private or protected member.  Yes, that requires a language lawyer.
> I've got the standard, but I'm not sure I'd be able to work out the
> answer from it.

The standard is extremely simplistic wrt access control...  I don't see 
anything hard about it.  :-)

You can't access things, unless you have been declared a friend, or, 
the stuff is public.  What can't you access, everything, types, 
members...  The code in question violates that simple clause, and the 
answer to how to make it work, is contained in that one clause.

The hard part, is realizing that g++ has historically been too lax and 
permitted things it should not have.



More information about the Gcc mailing list