Am 08.08.2008 um 00:09 schrieb Ken Worley:

Hi all,

I'm using Xcode 3.1 and just switched to gcc 4.2 from 4.0, but I've run into a problem with friend functions when compiling in objective- c++. I contrived an example that illustrates the problem:

[...]
This project builds fine using gcc 4.0, but when I switch the compiler setting to use gcc 4.2, I get the errors listed below. Any clues would certainly be appreciated if I'm doing something wrong. If not, I guess I'll file a bug...

Here's main.m:

#import <Cocoa/Cocoa.h>

class test1
{
public:
                friend test1* newtest1(int x)
                {
                        test1* anobj = new test1();
                        anobj->finishinit(x);
                        return anobj;
                }
[...]   
};

int main(int argc, char *argv[])
{
        test1* tobj = newtest1(5);
        delete tobj;
        
   return NSApplicationMain(argc,  (const char **) argv);
}

friend != static, and even then this probably would not be valid semantics.

test1* tobj = newtest1(5); has nothing to do with
test1::newtest1( int ) or aTest1Instance->newtest1( int )



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to