50 lines · plain
1// RUN: %clang_cc1 -fblocks -fsyntax-only -verify -Wno-objc-root-class %s2// expected-no-diagnostics3 4@interface NSObject5- (id)self;6- (id)copy;7@end8 9typedef struct _foo *__attribute__((NSObject)) Foo_ref;10 11@interface TestObject {12 Foo_ref dict;13}14@property(retain) Foo_ref dict;15@end16 17@implementation TestObject18@synthesize dict;19@end20 21@interface NSDictionary22- (int)retainCount;23@end24 25int main(int argc, char *argv[]) {26 NSDictionary *dictRef;27 Foo_ref foo = (Foo_ref)dictRef;28 29 // do Properties retain?30 int before = [dictRef retainCount];31 int after = [dictRef retainCount];32 33 if ([foo retainCount] != [dictRef retainCount]) {34 }35 36 // do Blocks retain?37 {38 void (^block)(void) = ^{39 [foo self];40 };41 before = [foo retainCount];42 id save = [block copy];43 after = [foo retainCount];44 if (after <= before) {45 ;46 }47 }48 return 0;49}50