[Bug c++/29615] Class can't be friends of itself?

jens-devel at gmx dot de gcc-bugzilla@gcc.gnu.org
Mon Oct 15 12:48:00 GMT 2007



------- 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



More information about the Gcc-bugs mailing list