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++/24592] Static_cast loses access to protected



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-10-31 15:32 -------
No, you cannot get around access checking like this.

b2 does not know anything about its super classes at all, and it should not
know anything about them.

Also the following applies:
b2 cannot access the stuff in another base class of G.
Like:
class b1{protected: int i;}  ;struct G; struct b2 { int f(G *); }; struct G:
b1, b2 {};  int b2::f(G *a){return a->i;}
is invalid as b2 cannot access b1's fields.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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