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: Question w.r.t. inside class defined struct for C++ language lawer.


Karel Gardas wrote:

>        4 class Foo
>        5 {
>        6 private:
>        7         typedef std::string Identifier;
>        8         //struct Operation;
>        9         //friend struct Operation;
>       10         struct Operation
>       11         {
>       12                 Identifier name;
>       13         };

> Sun's engineer wrote me this:
> ``This is not a bug:
> According to the 1998 C++ standard.  Struct members do not have any
> special access to other members of their enclosing class.
> You must explicitly grant permission.''

That's true, but there's a core language issue about this, see

   http://std.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#45

the proposed resolution is that nested classes have are members of enclosing
class and have full access to other members. I'm not sure what this means
formally...

> So my question is: are all compilers right? i.e. gcc, icc, como compiling
> it and CC complaining about it? 

.. but it's surely reasonable that gcc, icc and como accept this.

> Or are gcc, icc, como right and Sun's CC 
> is wrong and also engineer from support is wrong? 

Not that Sun is 100% wrong, but it would be nice if they adjust the
behaviour according to the resulution of issue 45.

- Volodya




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