This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/8662: [3.2 regression] illegal access of private member of unnamed class


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]