This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

Re: Type access control -- now too strict


> > > Apparently it's now impossible to define static data of private type
> > > if that private type has a constructor.
> > >     class B { B(int) {} };
> > [snip]
> > > A::B A::b(1);
> > 
> > Particularly when the type's constructor is private :-)
> 
> Ah, but that should work anyway, because A is an implicit friend of B.

It isn't. In standard C++, neither class is friend of the other.
According to Core Issue 45

# A member class should have access to the members of the enclosing
# class in the same manner as if it had been declared a friend of the
# enclosing class.

So B is implicit friend of A, but not vice versa.

Regards,
Martin

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