Does your init method return an object of type "X" or of type "id"?
That's completely irrelevant. Or at the very least should be. The C
assignment operator is -- far as I know and do someone please correct
me if I am wrong -- defined to have the type and value of the lvalue.
Which happens to work elsewhere, try e.g.
int n;
double d=3/(n=2.);
which would store 1, not 1.5 into d.
And finally, even if my memory was weak (which it is!), casting does
not help anyway:
140 /tmp> <q.m
#import <Cocoa/Cocoa.h>
@interface X:NSObject
@property(assign) id delegate;
@end
static X *x=nil;
void fnc() {
[(x=(X*)[[X alloc] init]).delegate class];
}
141 /tmp> cc -c q.m -fobjc-gc-only
q.m: In function 'fnc':
q.m:7: error: request for member 'delegate' in something not a
structure or union
142 /tmp>
:)
On Oct 4, 2008, at 12:07 PM, Ondřej Čada wrote:
Hi there,
do I overlook something of importance, or is this indeed a compiler
bug? Without GC it behaves all right; with GC though, it reports
spurious errors:
128 /tmp> <q.m
#import <Cocoa/Cocoa.h>
@interface X:NSObject
@property(assign) id delegate;
@end
static X *x=nil;
void fnc() {
[(x=[[X alloc] init]).delegate class];
}
129 /tmp> cc -c q.m
130 /tmp> cc -c q.m -fobjc-gc-only
q.m: In function 'fnc':
q.m:7: error: request for member 'delegate' in something not a
structure or union
131 /tmp>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden