From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5237 invoked by alias); 20 Jul 2006 11:55:22 -0000 Received: (qmail 5141 invoked by uid 48); 20 Jul 2006 11:55:12 -0000 Date: Thu, 20 Jul 2006 11:55:00 -0000 Subject: [Bug c++/28444] New: static_cast allowed, even if only the base class is accessible X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "tim at klingt dot org" 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 X-SW-Source: 2006-07/txt/msg01580.txt.bz2 List-Id: hi all, i searched for a similar bug, but i'm not sure, if it has been reported: the following code compiles fine with gcc, but it shouldn't: struct foo { friend class caster; }; struct bar: protected foo { }; struct caster { foo * cast(bar* b) { return static_cast(b); } }; int main() { bar * b = new bar; caster c; foo * f = c.cast(b); } from my understanding, it should only compile if, caster would be a friend of bar -- Summary: static_cast allowed, even if only the base class is accessible Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tim at klingt dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28444