1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
2 /* { dg-do compile } */
4 /* Test that when using @synthesize with a readonly property, the
5 instance variable can be a specialization of the property type. */
16 @interface ClassB : ClassA
30 ClassA <MyProtocol> *c;
32 @property (assign, readonly) int v;
33 @property (assign, readonly) float w;
34 @property (assign, readonly) id x;
35 @property (assign, readonly) Test *y;
36 @property (assign, readonly) id <MyProtocol> *z;
37 @property (assign, readonly) ClassA *a;
38 @property (assign, readonly) ClassB *b;
52 /* This is sometimes OK, sometimes not OK. */
55 int v; /* { dg-message "originally specified here" } */
56 float w; /* { dg-message "originally specified here" } */
57 id x; /* { dg-message "originally specified here" } */
59 id <MyProtocol> *z; /* { dg-message "originally specified here" } */
60 ClassA *a; /* { dg-message "originally specified here" } */
63 @property (assign, readonly) float v;
64 @property (assign, readonly) id w;
65 @property (assign, readonly) int x;
66 @property (assign, readonly) id y;
67 @property (assign, readonly) Test *z;
68 @property (assign, readonly) ClassB *a;
69 @property (assign, readonly) ClassA *b;
73 @synthesize v; /* { dg-error "property .v. is using instance variable .v. of incompatible type" } */
74 @synthesize w; /* { dg-error "property .w. is using instance variable .w. of incompatible type" } */
75 @synthesize x; /* { dg-error "property .x. is using instance variable .x. of incompatible type" } */
77 @synthesize z; /* { dg-error "property .z. is using instance variable .z. of incompatible type" } */
78 @synthesize a; /* { dg-error "property .a. is using instance variable .a. of incompatible type" } */