Bug 8662 - [3.2/3.3 regression] illegal access of private member of unnamed class
Summary: [3.2/3.3 regression] illegal access of private member of unnamed class
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2002-11-20 11:46 UTC by Volker Reichelt
Modified: 2003-07-25 17:33 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2002-11-20 11:46:01 UTC
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 Volker Reichelt 2002-11-20 11:46:01 UTC
Fix:
http://gcc.gnu.org/ml/gcc-patches/2002-11/msg01348.html
Comment 2 Volker Reichelt 2002-11-20 11:47:41 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
Comment 3 Joe Buck 2002-11-21 17:11:21 UTC
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 Mark Mitchell 2002-11-29 17:54:28 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in GCC 3.3.