1// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -fobjc-exceptions -verify -Wno-objc-root-class %s 2 3@interface MyClass { 4 id __weak myString; // expected-error {{existing instance variable 'myString' for strong property 'myString' may not be __weak}} 5 id StrongIvar; 6 id __weak myString2; // expected-error {{existing instance variable 'myString2' for strong property 'myString2' may not be __weak}} 7 id __weak myString3; 8 id StrongIvar5; // expected-error {{existing instance variable 'StrongIvar5' for __weak property 'myString5' must be __weak}} 9} 10@property (strong) id myString; // expected-note {{property declared here}} 11@property (strong) id myString1; 12@property (retain) id myString2; // expected-note {{property declared here}} 13// 14@property (weak) id myString3; 15@property (weak) id myString4; 16@property __weak id myString5; // expected-note {{property declared here}} 17@end 18 19@implementation MyClass 20@synthesize myString; // expected-note {{property synthesized here}} 21@synthesize myString1 = StrongIvar; // OK 22@synthesize myString2 = myString2; // expected-note {{property synthesized here}} 23// 24@synthesize myString3; // OK 25@synthesize myString4; // OK 26@synthesize myString5 = StrongIvar5; // expected-note {{property synthesized here}} 27 28@end 29 30@interface Foo { 31@public 32 id __unsafe_unretained x; // expected-error {{existing instance variable 'x' for __weak property 'x' must be __weak}} 33 id __strong y; // expected-error {{existing instance variable 'y' for __weak property 'y' must be __weak}} 34 id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}} 35} 36@property(weak) id x; // expected-note {{property declared here}} 37@property(weak) id y; // expected-note {{property declared here}} 38@property(weak) id z; 39@end 40 41@implementation Foo 42@synthesize x; // expected-note {{property synthesized here}} 43@synthesize y; // expected-note {{property synthesized here}} 44@synthesize z; // suppressed 45@end 46 47// Don't crash. 48@interface Test2 49// Minor FIXME: kill the redundant error 50@property (strong) UndeclaredClass *test2; // expected-error {{unknown type name 'UndeclaredClass'}} expected-error {{must be of object type}} 51@end 52@implementation Test2 53@synthesize test2; 54@end 55 56@interface Test3 57@property (strong) id exception; 58@end 59void test3(Test3 *t3) { 60 @throw t3.exception; 61} 62