1 // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify %s
6 id __unsafe_unretained x;
8 id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
10 @property(strong) id x;
11 @property(strong) id y;
12 @property(strong) id z;
17 id __unsafe_unretained x;
19 id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
21 @property(retain) id x;
22 @property(retain) id y;
23 @property(retain) id z;
28 id __unsafe_unretained x;
30 id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
37 // Errors should start about here :-)
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}}
42 @property(strong) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
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}}
48 @property(retain) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
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}}
54 @property(copy) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
58 @property(assign) __unsafe_unretained id x;
59 @property(assign) __weak id y; // expected-error {{unsafe_unretained property 'y' may not also be declared __weak}}
60 @property(assign) __autoreleasing id z; // expected-error {{unsafe_unretained property 'z' may not also be declared __autoreleasing}}
64 @property(unsafe_unretained) __unsafe_unretained id x;
65 @property(unsafe_unretained) __weak id y; // expected-error {{unsafe_unretained property 'y' may not also be declared __weak}}
66 @property(unsafe_unretained) __autoreleasing id z; // expected-error {{unsafe_unretained property 'z' may not also be declared __autoreleasing}}
71 @property (readonly, retain) id foo;
72 @property (readonly, weak) id fee;
73 @property (readonly, strong) id frr;
76 @interface Bugg : Super
77 @property (readwrite) id foo;
78 @property (readwrite) id fee;
79 @property (readwrite) id frr;
85 @interface NSObject @end
87 #pragma clang assume_nonnull begin
88 @interface I: NSObject
89 @property(nonatomic, weak) id delegate; // Do not warn, nullable is inferred.
90 @property(nonatomic, weak, readonly) id ROdelegate; // Do not warn, nullable is inferred.
91 @property(nonatomic, weak, nonnull) id NonNulldelete; // expected-error {{property attributes 'nonnull' and 'weak' are mutually exclusive}}
92 @property(nonatomic, weak, nullable) id Nullabledelete; // do not warn
95 @property(nonatomic, strong) id stdelegate; // Do not warn
96 @property(nonatomic, readonly) id stROdelegate; // Do not warn
97 @property(nonatomic, strong, nonnull) id stNonNulldelete; // Do not warn
98 @property(nonatomic, nullable) id stNullabledelete; // do not warn
100 #pragma clang assume_nonnull end
102 @interface J: NSObject
103 @property(nonatomic, weak) id ddd; // Do not warn, nullable is inferred.
104 @property(nonatomic, weak, nonnull) id delegate; // expected-error {{property attributes 'nonnull' and 'weak' are mutually exclusive}}
105 @property(nonatomic, weak, nonnull, readonly) id ROdelegate; // expected-error {{property attributes 'nonnull' and 'weak' are mutually exclusive}}
108 // rdar://problem/23931441
110 @property(readonly, retain) id prop;
113 __attribute__((objc_root_class))
118 @property (readwrite) id prop;