public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: sbeasley@cs.uic.edu To: gcc-gnats@gcc.gnu.org Subject: c++/10841: rejects valid explicit conversion to/from pointers-to-member of private base Date: Sun, 18 May 2003 05:16:00 -0000 [thread overview] Message-ID: <20030518051307.2348.qmail@sources.redhat.com> (raw) >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: <stdin>: In function `int main()': <stdin>:9: error: `main()::Base' is an inaccessible base of `main()::Derived' <stdin>: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:
reply other threads:[~2003-05-18 5:16 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030518051307.2348.qmail@sources.redhat.com \ --to=sbeasley@cs.uic.edu \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).