This is the mail archive of the gcc@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] |
On Jan 31, 2005, at 1:05 PM, Fariborz Jahanian wrote:
g++ issues a diagnostic on this test case.
Section 11.4 does not address this issue, but I think that this is a g++ bug. The
fact that a member function itself is 'protected' should not prevent it from accessing members of other
classes where it is declared as 'friend'.
% cat protected.C class FOO { protected: void Push(); };
class S { friend void FOO::Push(); };
The problem is the other way around. FOO::Push() is allowed to access private members of classes that declare it to be a friend, but nobody said that class S was allowed to access FOO's private or protected members. This code is illegal.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |