This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
The following code should be rejected, since a.i is a private member: ------------------snip here----------------------- class { int i; } a; void foo () { a.i; } ------------------snip here----------------------- gcc 2.95.x and 3.0.x correctly reject the code, however it is accepted with the 3.2-branch and mainline. BTW, all version reject the code if private is explicitly specified: class { private: int i; } a; or the class has a name: class A { int i; } a; The PR was distilled from Martin Buchholz's message: http://gcc.gnu.org/ml/gcc-bugs/2002-11/msg01022.html Release: 3.2-branch, mainline Environment: target independent
Fix: http://gcc.gnu.org/ml/gcc-patches/2002-11/msg01348.html
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed.
From: Joe Buck <jbuck@synopsys.com> To: gcc-gnats@gcc.gnu.org, martin@xemacs.org, reichelt@igpm.rwth-aachen.de, gcc-bugs@gcc.gnu.org Cc: Subject: Re: c++/8662: [3.2 regression] illegal access of private member of unnamed class Date: Thu, 21 Nov 2002 17:11:21 -0800 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8662 See http://gcc.gnu.org/ml/gcc-patches/2002-11/msg01348.html for a proposed patch.
State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed in GCC 3.3.