This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/24592] Static_cast loses access to protected
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Oct 2005 15:32:32 -0000
- Subject: [Bug c++/24592] Static_cast loses access to protected
- References: <bug-24592-6594@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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