This might be iPhone specific, I’m not sure. The compiler doesn’t complain when building for the simulator but when compiling for device it throws some funky errors when I try to set properties for references to objects. Eg,
@property (nonatomic) CGRect &finalFrame;
and the coressponding synthesizer
@synthesize finalFrame;
for a variable declared as
CGRect finalFrame;
Gives the errors
- type of property ‘finalFrame’ does not match type of ivar ‘finalFrame’
- Unrecognisable insn:
- Internal compiler error: Bus error
- Internal compiler error: in extract_insn, at recog.c:2904
However I can do it manually without issue, with the following methods:
- (CGRect&)finalFrame;
- (void)setFinalFrame:(CGRect&)aFrame;
Is this a gcc bug? It does compile for the simulator.
Your property is declared as a reference type (
CGRect&) but your instance variable is not a reference type (CGRect). They need to be the same to use@synthesize.Also, it’s a little weird to be using C++ reference types as Objective-C properties, but I guess that might work as long as all the files are being compiled as Objective-C++.