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
Description:   Last confirmed: 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

------- Comment #1 From Volker Reichelt 2002-11-20 11:46 -------
Fix:
http://gcc.gnu.org/ml/gcc-patches/2002-11/msg01348.html

------- Comment #2 From Volker Reichelt 2002-11-20 11:47 -------
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.

------- Comment #3 From Joe Buck 2002-11-21 17:11 -------
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.
 

------- Comment #4 From Mark Mitchell 2002-11-29 17:54 -------
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in GCC 3.3.