Bug 8662 - [3.2/3.3 regression] illegal access of private member of unnamed class
|
Bug#:
8662
|
Product: gcc
|
Version: 3.2
|
|
Host:
|
Target:
|
Build:
|
|
Status: RESOLVED
|
Severity: normal
|
Priority: P3
|
|
Resolution: FIXED
|
Assigned To: unassigned@gcc.gnu.org
|
Reported By: reichelt@igpm.rwth-aachen.de
|
|
Component: c++
|
Target Milestone: ---
|
|
Summary: [3.2/3.3 regression] illegal access of private member of unnamed class
|
|
Keywords: accepts-invalid
|
|
Opened: 2002-11-20 11:46
|
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
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in GCC 3.3.