This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Clarification regarding a non-bug in gcc.gnu.org
- From: Hariharan S <hariharan at csa dot iisc dot ernet dot in>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 20 Aug 2003 16:54:12 +0530 (IST)
- Subject: Clarification regarding a non-bug in gcc.gnu.org
Hi,
I visited gcc.gnu.org page. In that page under the heading Non-bugs it is
written that "Nested classes can access private types of the containing
class". This is incorrect and I referred the book C++ Primer by Stanley B.
Lippman & Josie Lajoie. I also sent a mail to Bjarne Stroustrup regarding
this. He also said that what is given in the webpage is incorrect. He
asked you to refer section 9.7 of the standard. Given below is the reply
to my question regarding this. If my understanding of the statement in the
page is incorrect please give me an example.
Regards,
Hariharan S
---------- Forwarded message ----------
Date: Sat, 9 Aug 2003 16:50:09 -0400 (EDT)
From: Bjarne Stroustrup <bs@research.att.com>
To: hariharan@csa.iisc.ernet.in
Subject: Re: Doubt in C++
>Date: Thu, 7 Aug 2003 23:14:31 +0530 (IST)
>From: Hariharan S <hariharan@csa.iisc.ernet.in>
>To: bs@research.att.com
>Subject: Doubt in C++
>Dear Mr. Stroustrup,
>I visited http://gcc.gnu.org/bugs.html#known. In that page under the
>heading Non-bugs it is written that "Nested classes can access private
>types of the containing class".
>
>class Nesting
>{
>int a;
>class Nested
>{
>void foo();
>};
>};
>
>i.e., in the above code foo() can access Nesting::a. I think gnu is wrong.
>Please clarify.
>Regards,
>Hariharan S
>
>
You are right. That example is an error. Please refer them to section 9.7 of the
standard
- Bjarne
Bjarne Stroustrup, http://www.research.att.com/~bs