1 // RUN: %clang_cc1 -arcmt-action=check -verify -triple x86_64-apple-macosx10.7 %s
5 @interface NSInvocation : NSObject
6 - (void)getReturnValue:(void *)retLoc;
7 - (void)setReturnValue:(void *)retLoc;
9 - (void)getArgument:(void *)argumentLocation atIndex:(int)idx;
10 - (void)setArgument:(void *)argumentLocation atIndex:(int)idx;
16 @implementation Test {
19 __unsafe_unretained id unsafe_id;
22 - (void) test:(NSInvocation *)invok {
23 [invok getReturnValue:&strong_id]; // expected-error {{NSInvocation's getReturnValue is not safe to be used with an object with ownership other than __unsafe_unretained}}
24 [invok getReturnValue:&weak_id]; // expected-error {{NSInvocation's getReturnValue is not safe to be used with an object with ownership other than __unsafe_unretained}}
25 [invok getReturnValue:&unsafe_id];
26 [invok getReturnValue:&arg];
28 [invok setReturnValue:&strong_id]; // expected-error {{NSInvocation's setReturnValue is not safe to be used with an object with ownership other than __unsafe_unretained}}
29 [invok setReturnValue:&weak_id]; // expected-error {{NSInvocation's setReturnValue is not safe to be used with an object with ownership other than __unsafe_unretained}}
30 [invok setReturnValue:&unsafe_id];
31 [invok setReturnValue:&arg];
33 [invok getArgument:&strong_id atIndex:0]; // expected-error {{NSInvocation's getArgument is not safe to be used with an object with ownership other than __unsafe_unretained}}
34 [invok getArgument:&weak_id atIndex:0]; // expected-error {{NSInvocation's getArgument is not safe to be used with an object with ownership other than __unsafe_unretained}}
35 [invok getArgument:&unsafe_id atIndex:0];
36 [invok getArgument:&arg atIndex:0];
38 [invok setArgument:&strong_id atIndex:0]; // expected-error {{NSInvocation's setArgument is not safe to be used with an object with ownership other than __unsafe_unretained}}
39 [invok setArgument:&weak_id atIndex:0]; // expected-error {{NSInvocation's setArgument is not safe to be used with an object with ownership other than __unsafe_unretained}}
40 [invok setArgument:&unsafe_id atIndex:0];
41 [invok setArgument:&arg atIndex:0];