blob: 11f431377da6e6e68cab625047bfafe0edb9ba90 [file] [log] [blame]
John McCalld1e40d52011-10-02 01:16:38 +00001// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-macosx10.7 %s
Argyrios Kyrtzidisfd103982011-07-18 07:44:45 +00002
3#include "Common.h"
4
5@interface NSInvocation : NSObject
6- (void)getReturnValue:(void *)retLoc;
7- (void)setReturnValue:(void *)retLoc;
8
9- (void)getArgument:(void *)argumentLocation atIndex:(int)idx;
10- (void)setArgument:(void *)argumentLocation atIndex:(int)idx;
11@end
12
13@interface Test
14@end
15
16@implementation Test {
17 id strong_id;
18 __weak id weak_id;
19 __unsafe_unretained id unsafe_id;
20 int arg;
21}
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];
27
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];
32
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];
37
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];
42}
43@end