From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8147 invoked by alias); 18 May 2003 05:16:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 8109 invoked by uid 71); 18 May 2003 05:16:00 -0000 Resent-Date: 18 May 2003 05:16:00 -0000 Resent-Message-ID: <20030518051600.8108.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, sbeasley@cs.uic.edu Received: (qmail 2349 invoked by uid 48); 18 May 2003 05:13:07 -0000 Message-Id: <20030518051307.2348.qmail@sources.redhat.com> Date: Sun, 18 May 2003 05:16:00 -0000 From: sbeasley@cs.uic.edu Reply-To: sbeasley@cs.uic.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/10841: rejects valid explicit conversion to/from pointers-to-member of private base X-SW-Source: 2003-05/txt/msg02014.txt.bz2 List-Id: >Number: 10841 >Category: c++ >Synopsis: rejects valid explicit conversion to/from pointers-to-member of private base >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Sun May 18 05:16:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Shane Beasley >Release: gcc version 3.3 20030415 (Debian prerelease) >Organization: >Environment: Linux v2.4.19 (Debian) on Intel x86-compatible >Description: Section 5.4, paragraph 7, of ISO/IEC 14882:1998 (ISO C++) allows C-style cast notation to convert a pointer-to-member of a derived class to a pointer-to-member of a unambiguous non-virtual base class or vice versa, regardless of the accessibility of the base class. GCC 3.3 emits the following diagnostic: : In function `int main()': :9: error: `main()::Base' is an inaccessible base of `main()::Derived' :10: error: `main()::Base' is an inaccessible base of `main()::Derived' >How-To-Repeat: int main () { class Base { public: int i, j, k; }; class Derived : private Base { public: int m, n, p; }; Derived derived; Base &base = (Base &)derived; // neither line compiles; 5.4p7 allows both base.*((int Base::*)&Derived::n) = 0xdeadbeef; derived.*((int Derived::*)&Base::j) = 0xc0decafe; } >Fix: Do not check for accessibility of the base class if C-style cast notation is used. >Release-Note: >Audit-Trail: >Unformatted: