1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify %s 2*f4a2713aSLionel Sambuc// rdar://9340606 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc@interface Foo { 5*f4a2713aSLionel Sambuc@public 6*f4a2713aSLionel Sambuc id __unsafe_unretained x; 7*f4a2713aSLionel Sambuc id __weak y; 8*f4a2713aSLionel Sambuc id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}} 9*f4a2713aSLionel Sambuc} 10*f4a2713aSLionel Sambuc@property(strong) id x; 11*f4a2713aSLionel Sambuc@property(strong) id y; 12*f4a2713aSLionel Sambuc@property(strong) id z; 13*f4a2713aSLionel Sambuc@end 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc@interface Bar { 16*f4a2713aSLionel Sambuc@public 17*f4a2713aSLionel Sambuc id __unsafe_unretained x; 18*f4a2713aSLionel Sambuc id __weak y; 19*f4a2713aSLionel Sambuc id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}} 20*f4a2713aSLionel Sambuc} 21*f4a2713aSLionel Sambuc@property(retain) id x; 22*f4a2713aSLionel Sambuc@property(retain) id y; 23*f4a2713aSLionel Sambuc@property(retain) id z; 24*f4a2713aSLionel Sambuc@end 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc@interface Bas { 27*f4a2713aSLionel Sambuc@public 28*f4a2713aSLionel Sambuc id __unsafe_unretained x; 29*f4a2713aSLionel Sambuc id __weak y; 30*f4a2713aSLionel Sambuc id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}} 31*f4a2713aSLionel Sambuc} 32*f4a2713aSLionel Sambuc@property(copy) id x; 33*f4a2713aSLionel Sambuc@property(copy) id y; 34*f4a2713aSLionel Sambuc@property(copy) id z; 35*f4a2713aSLionel Sambuc@end 36*f4a2713aSLionel Sambuc 37*f4a2713aSLionel Sambuc// Errors should start about here :-) 38*f4a2713aSLionel Sambuc 39*f4a2713aSLionel Sambuc@interface Bat 40*f4a2713aSLionel Sambuc@property(strong) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}} 41*f4a2713aSLionel Sambuc@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*f4a2713aSLionel Sambuc@property(strong) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}} 43*f4a2713aSLionel Sambuc@end 44*f4a2713aSLionel Sambuc 45*f4a2713aSLionel Sambuc@interface Bau 46*f4a2713aSLionel Sambuc@property(retain) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}} 47*f4a2713aSLionel Sambuc@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*f4a2713aSLionel Sambuc@property(retain) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}} 49*f4a2713aSLionel Sambuc@end 50*f4a2713aSLionel Sambuc 51*f4a2713aSLionel Sambuc@interface Bav 52*f4a2713aSLionel Sambuc@property(copy) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}} 53*f4a2713aSLionel Sambuc@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*f4a2713aSLionel Sambuc@property(copy) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}} 55*f4a2713aSLionel Sambuc@end 56*f4a2713aSLionel Sambuc 57*f4a2713aSLionel Sambuc@interface Bingo 58*f4a2713aSLionel Sambuc@property(assign) __unsafe_unretained id x; 59*f4a2713aSLionel Sambuc@property(assign) __weak id y; // expected-error {{property attributes 'assign' and 'weak' are mutually exclusive}} 60*f4a2713aSLionel Sambuc@property(assign) __autoreleasing id z; // expected-error {{unsafe_unretained property 'z' may not also be declared __autoreleasing}} 61*f4a2713aSLionel Sambuc@end 62*f4a2713aSLionel Sambuc 63*f4a2713aSLionel Sambuc@interface Batman 64*f4a2713aSLionel Sambuc@property(unsafe_unretained) __unsafe_unretained id x; 65*f4a2713aSLionel Sambuc@property(unsafe_unretained) __weak id y; // expected-error {{property attributes 'unsafe_unretained' and 'weak' are mutually exclusive}} 66*f4a2713aSLionel Sambuc@property(unsafe_unretained) __autoreleasing id z; // expected-error {{unsafe_unretained property 'z' may not also be declared __autoreleasing}} 67*f4a2713aSLionel Sambuc@end 68*f4a2713aSLionel Sambuc 69*f4a2713aSLionel Sambuc// rdar://9396329 70*f4a2713aSLionel Sambuc@interface Super 71*f4a2713aSLionel Sambuc@property (readonly, retain) id foo; 72*f4a2713aSLionel Sambuc@property (readonly, weak) id fee; 73*f4a2713aSLionel Sambuc@property (readonly, strong) id frr; 74*f4a2713aSLionel Sambuc@end 75*f4a2713aSLionel Sambuc 76*f4a2713aSLionel Sambuc@interface Bugg : Super 77*f4a2713aSLionel Sambuc@property (readwrite) id foo; 78*f4a2713aSLionel Sambuc@property (readwrite) id fee; 79*f4a2713aSLionel Sambuc@property (readwrite) id frr; 80*f4a2713aSLionel Sambuc@end 81*f4a2713aSLionel Sambuc 82