1// RUN: %clang_cc1 -fsyntax-only -verify -disable-objc-default-synthesize-properties -Wno-objc-root-class %s
2
3@interface Object
4+ (id)new;
5@end
6
7@interface ReadOnly : Object
8{
9  int _object;
10  int _Anotherobject;
11}
12@property(readonly) int object;
13@property(readonly) int Anotherobject;
14@end
15
16@interface ReadOnly ()
17@property(readwrite) int object;
18@property(readwrite, setter = myAnotherobjectSetter:) int Anotherobject;
19@end
20
21@implementation ReadOnly
22@synthesize object = _object;
23@synthesize  Anotherobject = _Anotherobject;
24- (void) myAnotherobjectSetter : (int)val {
25    _Anotherobject = val;
26}
27- (int) Anotherobject { return _Anotherobject; }
28@end
29
30int main(int argc, char **argv) {
31    ReadOnly *test = [ReadOnly new];
32    test.object = 12345;
33    test.Anotherobject = 200;
34    return test.object - 12345 + test.Anotherobject - 200;
35}
36
37///
38
39@interface I0
40@property(readonly) int p0;	// expected-note {{property declared here}}
41@end
42
43@interface I0 (Cat0)
44@end
45
46@interface I0 (Cat1)
47@end
48
49@implementation I0	// expected-warning {{property 'p0' requires method 'p0' to be define}}
50- (void) foo {
51  self.p0 = 0; // expected-error {{assignment to readonly property}}
52}
53@end
54