blob: a1b181c4f7d9b49724d809c16639a2a97710f73a [file] [log] [blame]
Fariborz Jahanian528a4992011-09-14 18:03:46 +00001// RUN: %clang_cc1 -fsyntax-only -fblocks -fobjc-arc -fobjc-nonfragile-abi -verify %s
2// rdar://9829425
3
4extern void doSomething();
5
6@interface Test
7{
8@public
9 void (^aBlock)(void);
10}
11@property (retain) void (^aBlock)(void); // expected-warning {{retain'ed block property does not copy the block - use copy attribute instead}}
12@property (weak, retain) void (^aBlockW)(void); // expected-error {{property attributes 'retain' and 'weak' are mutually exclusive}}
13@property (strong, retain) void (^aBlockS)(void); // OK
14@property (readonly, retain) void (^aBlockR)(void); // OK
15@property (copy, retain) void (^aBlockC)(void); // expected-error {{property attributes 'copy' and 'retain' are mutually exclusive}}
16@property (assign, retain) void (^aBlockA)(void); // expected-error {{property attributes 'assign' and 'retain' are mutually exclusive}}
17@end
18
19@implementation Test
20@synthesize aBlock;
21@dynamic aBlockW, aBlockS, aBlockR, aBlockC, aBlockA;
22@end
23
24int main() {
25 Test *t;
26 t.aBlock = ^{ doSomething(); };
27 t.aBlockW = ^{ doSomething(); };
28 t.aBlockS = ^{ doSomething(); };
29}
30