blob: 0dd74b8ad5cecec8f70d7be8bd1a96a717126824 [file] [log] [blame]
John McCall9f084a32011-07-06 00:26:06 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify %s
John McCallf85e1932011-06-15 23:02:42 +00002// rdar://9340606
3
4@interface Foo {
5@public
6 id __unsafe_unretained x;
7 id __weak y;
Argyrios Kyrtzidisb8b03132011-06-24 00:08:59 +00008 id __autoreleasing z; // expected-error {{ivars cannot have __autoreleasing ownership}}
John McCallf85e1932011-06-15 23:02:42 +00009}
10@property(strong) id x;
11@property(strong) id y;
12@property(strong) id z;
13@end
14
15@interface Bar {
16@public
17 id __unsafe_unretained x;
18 id __weak y;
Argyrios Kyrtzidisb8b03132011-06-24 00:08:59 +000019 id __autoreleasing z; // expected-error {{ivars cannot have __autoreleasing ownership}}
John McCallf85e1932011-06-15 23:02:42 +000020}
21@property(retain) id x;
22@property(retain) id y;
23@property(retain) id z;
24@end
25
26@interface Bas {
27@public
28 id __unsafe_unretained x;
29 id __weak y;
Argyrios Kyrtzidisb8b03132011-06-24 00:08:59 +000030 id __autoreleasing z; // expected-error {{ivars cannot have __autoreleasing ownership}}
John McCallf85e1932011-06-15 23:02:42 +000031}
32@property(copy) id x;
33@property(copy) id y;
34@property(copy) id z;
35@end
36
37// Errors should start about here :-)
38
39@interface Bat
40@property(strong) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}}
41@property(strong) __weak id y; // expected-error {{strong property 'y' may not also be declared __weak}} expected-error {{property attributes 'strong' and 'weak' are mutually exclusive}}
42@property(strong) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
43@end
44
45@interface Bau
46@property(retain) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}}
47@property(retain) __weak id y; // expected-error {{strong property 'y' may not also be declared __weak}} expected-error {{property attributes 'retain' and 'weak' are mutually exclusive}}
48@property(retain) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
49@end
50
51@interface Bav
52@property(copy) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}}
53@property(copy) __weak id y; // expected-error {{strong property 'y' may not also be declared __weak}} expected-error {{property attributes 'copy' and 'weak' are mutually exclusive}}
54@property(copy) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
55@end
56
57@interface Bingo
58@property(assign) __unsafe_unretained id x;
59@property(assign) __weak id y; // expected-error {{property attributes 'assign' and 'weak' are mutually exclusive}}
60@property(assign) __autoreleasing id z; // expected-error {{unsafe_unretained property 'z' may not also be declared __autoreleasing}}
61@end
62
63@interface Batman
64@property(unsafe_unretained) __unsafe_unretained id x;
65@property(unsafe_unretained) __weak id y; // expected-error {{property attributes 'unsafe_unretained' and 'weak' are mutually exclusive}}
66@property(unsafe_unretained) __autoreleasing id z; // expected-error {{unsafe_unretained property 'z' may not also be declared __autoreleasing}}
67@end