1 // RUN: %clang_cc1 -fsyntax-only -verify %s
4 @property(readonly) int x;
5 @property(readonly) int y;
6 @property(readonly) int z;
7 -(void) setY: (int) y0;
11 -(void) setX: (int) a0;
18 -(void) setY: (int) y0{}
23 self.z = 2; // expected-error {{assigning to property with 'readonly' attribute not allowed}}
27 // Test when property is 'readonly' but it has a setter in
28 // its implementation only.
31 @property(readonly) int identifier;
37 - (void)setIdentifier:(int)ident {}
39 - (id)initWithIdentifier:(int)Arg {
46 // Also in a category implementation
48 @property(readonly) int rprop;
52 @implementation I1(CAT)
54 - (void)setRprop:(int)ident {}
56 - (id)initWithIdentifier:(int)Arg {
69 @interface Subclass : Root
73 - (void) setSetterOnly:(int)value;
76 @implementation Subclass
77 - (void) setSetterOnly:(int)value {
85 - (void)setFoo:(int)value;
92 g(c.Foo); // expected-error {{expected getter method not found on object of type 'C *'}}
98 Subclass *x = [[Subclass alloc] init];
100 x.setterOnly = 4; // OK