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

Re: (C++) patch to protected member access


>>>>> Mark Mitchell <mark@codesourcery.com> writes:

>>>>> "Jason" == Jason Merrill <jason@cygnus.com> writes:
 Jason> Note that my patch also fixes

 Jason>   struct A { protected: int i; };

 Jason>   struct B: public A { };

 Jason>   struct C: public A { void f () { B::i = 0; } };

 Jason> Here, i is accessible when named in B because it's
 Jason> accessible when named in A.  Before my patch, g++ was
 Jason> treating B specially in protected_accessible_p, which is
 Jason> not appropriate.

 > I assume you meant `C : public B'?

Nope, I meant what I wrote.  It's an odd thing to do, but I believe
well-formed.

Jason

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