From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27464 invoked by alias); 31 Oct 2005 15:32:37 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 27441 invoked by uid 48); 31 Oct 2005 15:32:32 -0000 Date: Mon, 31 Oct 2005 15:32:00 -0000 Message-ID: <20051031153232.27440.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/24592] Static_cast loses access to protected In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pinskia at gcc dot gnu dot org" X-SW-Source: 2005-10/txt/msg04142.txt.bz2 List-Id: ------- 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