blob: 991246c72fd46dcb3616deb7e475908d057aca43 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fblocks -fsyntax-only -verify %s
Fariborz Jahanian636bed12009-05-21 21:04:28 +00002
3@interface NSObject
4- (id)self;
5- (id)copy;
6@end
7
8typedef struct _foo *__attribute__((NSObject)) Foo_ref;
9
10@interface TestObject {
11 Foo_ref dict;
12}
13@property(retain) Foo_ref dict;
14@end
15
16@implementation TestObject
17@synthesize dict;
18@end
19
20@interface NSDictionary
21- (int)retainCount;
22@end
23
24int main(int argc, char *argv[]) {
25 NSDictionary *dictRef;
26 Foo_ref foo = (Foo_ref)dictRef;
27
28 // do Properties retain?
29 int before = [dictRef retainCount];
30 int after = [dictRef retainCount];
31
32 if ([foo retainCount] != [dictRef retainCount]) {
33 }
34
35 // do Blocks retain?
36 {
37 void (^block)(void) = ^{
38 [foo self];
39 };
40 before = [foo retainCount];
41 id save = [block copy];
42 after = [foo retainCount];
43 if (after <= before) {
44 ;
45 }
46 }
47 return 0;
48}