[Bug c++/29615] Class can't be friends of itself?
--- 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 F0; // 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 Fz; }; warning: class Fz 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
[Bug c++/29615] Class can't be friends of itself?
--- Comment #6 from redi at gcc dot gnu dot org 2010-03-27 20:19 --- I think the warning is reasonable, but it would be nice if it could be disabled. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29615
[Bug c++/29615] Class can't be friends of itself?
--- Comment #4 from potswa at mac dot com 2010-03-26 21:08 --- 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 F0; // error only if 0 removed }; template class F0; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29615
[Bug c++/29615] Class can't be friends of itself?
--- Comment #3 from jens-devel at gmx dot de 2007-10-15 12:48 --- Subject: Class can't be friends of itself? Hi, I think gcc should be able to compile something like this. There is no other way to make a member-variable accessible only from all objects which are of the same type. Am I wrong? test.cpp class A { friend class A; private: int var_accessible_from_all_A_objects; }; int main() { return 0; } /test.cpp Greetings Jens -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29615
[Bug c++/29615] Class can't be friends of itself?
-- pcarlini at suse dot de changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |pcarlini at suse dot de |dot org | Status|NEW |ASSIGNED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29615
[Bug c++/29615] Class can't be friends of itself?
-- pcarlini at suse dot de changed: What|Removed |Added AssignedTo|pcarlini at suse dot de |unassigned at gcc dot gnu ||dot org Status|ASSIGNED|NEW http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29615
[Bug c++/29615] Class can't be friends of itself?
--- Comment #2 from pinskia at gcc dot gnu dot org 2006-10-28 18:44 --- As far as I can tell this has been a pedwarning since the begining of the C++ front-end. -- pinskia at gcc dot gnu dot org changed: What|Removed |Added Keywords||rejects-valid http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29615
[Bug c++/29615] Class can't be friends of itself?
--- Comment #1 from bangerth at dealii dot org 2006-10-27 22:57 --- Confirmed. -- bangerth at dealii dot org changed: What|Removed |Added CC||bangerth at dealii dot org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2006-10-27 22:57:33 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29615