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

[Bug c++/52136] g++ is wrongly propagating "friend class" to the parent class


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52136

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-06 14:24:39 UTC ---
(In reply to comment #4)
> I am not really sure to understand why friend class should impact his parent
> but if g++ respects the standard, why not...

It doesn't "impact his parent"

Read comment 2 again.  To access a protected non-static member you must do so
though an object expression of the derived type, because in the expression
'p->address::m' you only know if 'm' is a member of a 'mailbox' object when 'p'
has type 'mailbox*'

But for a static member that is irrelevant, the static member just exists
independently of any 'mailbox' or 'address' instance, so if mailboxField can
access members of 'mailbox' then it can access the static member, and it
doesn't matter if you refer to it as 'mailbox::parseNext' or
'address::parseNext' because both refer to the exact same entity.


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