This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

friends and inner classes


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]