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