This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/8662: [3.2 regression] illegal access of private member of unnamed class
- From: reichelt at igpm dot rwth-aachen dot de
- To: gcc-gnats at gcc dot gnu dot org
- Cc: martin at xemacs dot org
- Date: 20 Nov 2002 19:41:43 -0000
- Subject: c++/8662: [3.2 regression] illegal access of private member of unnamed class
- Reply-to: reichelt at igpm dot rwth-aachen dot de
>Number: 8662
>Category: c++
>Synopsis: [3.2 regression] illegal access of private member of unnamed class
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Wed Nov 20 11:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Martin Buchholz, Volker Reichelt
>Release: 3.2-branch, mainline
>Organization:
>Environment:
target independent
>Description:
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
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: