This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
g++: 'protected' member function cannot be declared friend
- From: Fariborz Jahanian <fjahanian at apple dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 31 Jan 2005 13:05:34 -0800
- Subject: g++: 'protected' member function cannot be declared friend
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();
};
% g++ -c protected.C
protected.C:3: error: 'void FOO::Push()' is protected
protected.C:7: error: within this context
- fariborz