From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23125 invoked by alias); 12 Apr 2014 06:35:46 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23096 invoked by uid 48); 12 Apr 2014 06:35:42 -0000 From: "trippels at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60829] Illegal access to private base of public base granted. Date: Sat, 12 Apr 2014 06:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: trippels at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc target_milestone everconfirmed cf_known_to_fail Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg00904.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60829 Markus Trippelsdorf changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2014-04-12 CC| |trippels at gcc dot gnu.org Target Milestone|--- |4.7.5 Ever confirmed|0 |1 Known to fail| |4.7.3, 4.8.3, 4.9.0 --- Comment #3 from Markus Trippelsdorf --- markus@x4 /tmp % cat test.ii class A { public: int a; }; class B : private A { }; class C : public A { }; class D : public B, public C { D () { B::a = 0; } }; markus@x4 /tmp % g++ -c test.ii markus@x4 /tmp % clang++ -c test.ii test.ii:17:13: error: cannot cast 'B' to its private base class 'A' D () { B::a = 0; } ^ test.ii:7:11: note: declared private here class B : private A ^~~~~~~~~ test.ii:17:13: error: 'a' is a private member of 'A' D () { B::a = 0; } ^ test.ii:7:11: note: constrained by private inheritance here class B : private A ^~~~~~~~~ test.ii:4:7: note: member is declared here int a; ^ 2 errors generated.