[Bug c++/36499] New: non-compliant behaviour with nested classes
philippe dot dunski at ibelgique dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 11 14:12:00 GMT 2008
First, please excuse me for my poor english.
Actual standard says on section 11.8 Nested classes [class.access.nest]
The members of a nested class have no special access to members of an enclosing
class, nor to classes or
functions that have granted friendship to an enclosing class; the usual access
rules (clause 11) shall be
obeyed. The members of an enclosing class have no special access to members of
a nested class; the usual
access rules (clause 11) shall be obeyed and gives as example
class E {
int x;
class B { };
class I {
B b; // error: E::B is private
int y;
void f(E* p, int i)
{
p->x = i; // error: E::x is private
}
};
int g(I* p)
{
return p->y; // error: I::y is private
}
};
While trying this code, Gcc sees well that I::y is private in the g function,
but doesn't in the void e::i::f one, nor for the B b declaration.
--
Summary: non-compliant behaviour with nested classes
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: philippe dot dunski at ibelgique dot com
GCC host triplet: i686-pc-mingw32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36499
More information about the Gcc-bugs
mailing list