help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

access to enclosing class from a nested class


From: Dmitry Chumack
Subject: access to enclosing class from a nested class
Date: Mon, 3 Dec 2007 11:24:33 -0800 (PST)
User-agent: G2/1.0

Hi *

>From C++ standart ANSI ISO IEC 14882 2003:

11.8 The members of a nested class have no special access to members
of an enclosing class ...; the usual access rules (clause 11) shall be
obeyed. [Example:

class E {
  int x;
  class I {
    void f(E* p, int i)
    {
      p->x = i; // error: E::x is private
    }
  };
};
--end example]

But I test it on gcc 4.1.2 and it violates the standart! I've tried to
compile the above example and I've got no error messages! What does it
means? Is this a known bug? In which versions of gcc it present?

Thanks


reply via email to

[Prev in Thread] Current Thread [Next in Thread]