This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
friends and inner classes
- To: egcs <egcs dot egcs at cygnus dot com>
- Subject: friends and inner classes
- From: Nyny <Nyny dot sxthree at penfeld dot tls dot mms dot fr>
- Date: Thu, 04 Jun 1998 19:11:15 +0200
Hi all,
I've already posted that a couple of times but got no answer:
What about the following code -
class foo {
public:
class bar;
int func(bar *);
class bar {
int st;
public:
bar(){st=12;}
~bar(){}
friend int foo::func(bar *);
};
foo(){}
~foo(){}
};
When trying to compile this I get:
g++ -c -o foo.o foo.cc
foo.cc:10: member `foo::func(foo::bar *)' declared as friend before type
`foo' defined
C++ draft of dec 96 (Where can I get a newer one ?????) says that the
identifier `foo' must be defined in the scope of the class definition. I
think
g++ is wrong at least with the error message cuz foo is indeed defined.
Am I missing something ??
FM