[cfe-dev] ARC and @synthesize of read only property

Jean-Daniel Dupas devlists at shadowlab.org
Tue Jul 19 11:46:53 PDT 2011

When I'm trying to synthesize a read only property in obj-c, I get the following error.

error: ARC forbids synthesizing a property of an Objective-C object with unspecified storage attribute [4]

I understand why it is necessary to specify storage attribute to generate a setter, but why is it relevant to generate a getter ? 

Just in case, here is a simple test case:

@interface Foo { id _ivar; }
@property(nonatomic, readonly) id ivar;
@implementation Foo
@synthesize ivar = _ivar;

Trying to compile this code using -fobjc-arc fails.

-- Jean-Daniel

More information about the cfe-dev mailing list