autoconf/137: g++ composititon friendship doesn't work
Akim Demaille
akim@epita.fr
Tue Jul 18 07:32:00 GMT 2000
| >Number: 137
| >Category: autoconf
| >Synopsis: g++ composititon friendship doesn't work
| >Confidential: no
| >Severity: non-critical
| >Priority: medium
| >Responsible: bje
| >State: open
| >Class: sw-bug
| >Submitter-Id: net
| >Arrival-Date: Mon Jul 17 12:42:01 PDT 2000
| >Closed-Date:
| >Last-Modified:
| >Originator: Rigel Freden
| >Release: unknown-1.0
| >Organization:
| >Environment:
| i586 redhat 6.0?, 6.1?
| >Description:
| This might not even be a bug but... The sample code provided
| shouldn't compile (if it does, mail me and I'll send you the
| code in which I originally discovered it), I don't remember
| the error message, but try it.
| >How-To-Repeat:
| //start fawhack.cpp
| class Y;
|
| class X{
| friend Y;
| public:
| X():xmember(666){}
| private:
| int xmember;
| };
| class Y{
| public:
| X x;
| };
| main()
| {
| Y y;
| y.x.xmember=69696;//error
| }
| //end fagwhack.cpp
|
| Just compile this code like: g++ -o fagwhack fagwhack.cpp
| No special options or anything.
| >Fix:
| The way I fixed it was just to make a method in class Y like
| this:
|
| public:
| inline int xmember() const {return x.xmember}
|
| but I think this is particularly ungraceful and should be
| able to be done in the way I originally tried
| >Release-Note:
| >Audit-Trail:
| >Unformatted:
Hi,
This is not an Autoconf bug. The interface you used to report this
bug sets the default category to `Autoconf' and you forgot (most
probably just even see the field) to change it to GCC.
I think the GCC team should change this page, this is the 5th or 6th
time this happens.
Regards,
Akim
More information about the Gcc-bugs
mailing list