does friend qualify as a forward decl?
Tom Marshall
tommy@home.tig-grr.com
Thu Jun 23 15:39:00 GMT 2005
I've been playing with GCC 4.0 recently and discovered that the code below
does not compile with Debian's 4.0.0-9 package. The changelog for that
package says:
* Update to CVS 20050522, taken from the gcc-4_0-branch.
Note that the code compiles fine with GCC 3.3.5 (Debian), GCC 4.0.0 (RHEL4),
Sun Workshop, and MSVC.
I'm not terribly familiar with the C++ standard on this point -- can someone
tell me whether this should compile or not and, if yes, will this be fixed
when 4.0.1 is released?
Thanks.
[please cc: me on replies]
// Begin source code
class B;
class Foo
{
friend class A;
friend class B;
public:
Foo();
virtual ~Foo();
A* get_a() { return my_a; }
B* get_b() { return my_b; }
void set_a(A* t) { my_a = t; }
void set_b(B* r) { my_b = r; }
protected:
A* my_a;
B* my_b;
};
--
Hippopotomonstrosesquippedaliophobia is the fear of long words
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20050623/c642c2a5/attachment.sig>
More information about the Gcc
mailing list