This is the mail archive of the gcc@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]

RE: Nested Class Member Access


Is this behavior on GCC's part (that is, nested classes are members of the enclosing class and thus have all access rights that other members have) intentional? 

If so, should it be documented in the "Extensions to the C++ Language" section of the GCC online documents.

In any case, it seems that I should not submit a problem report.

-----Original Message-----
From: Florian Weimer [mailto:fw@deneb.enyo.de]
Sent: Thursday, September 02, 2004 12:23 PM
To: Steven L. Zook
Cc: GCC Mailing List (E-mail)
Subject: Re: Nested Class Member Access


* Steven L. Zook:

> According to ISO/IEC 14882-2003 (is this the correct standard for
> GCC?) 11.8.1 [class.access.nest], I believe this should be an
> error. The paragraph says that nested classes have no special access
> rights to enclosing class members. Since cOuter::Variable is
> private, cOuter::cInner::Function should not have access to it.

Your are correct that your example is not valid C++, but this may
change:

  <http://ra.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#45>


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