------- Comment #5 from redi at gcc dot gnu dot org 2010-03-27 20:14 ------- With current versions this is only a warning not an error, changing keywords from rejects-valid to diagnostic
(In reply to comment #3) > There is no other way to make a member-variable accessible only from all > objects which are of the same type. Am I wrong? Yes. (In reply to comment #4) > The error doesn't occur if the friend is a template instance, so it really > doesn't hurt anyone. But it's weird. > > template< int z > > class F { > friend class F<0>; // error only if <0> removed > }; Well in that case it isn't friends with itself, so not really weird. This shows that being a template has nothing to do with it: template< int z > class F { friend class F<z>; }; warning: class F<z> is implicitly friends with itself -- redi at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rejects-valid |diagnostic http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29615