#import <Foundation/Foundation.h>
int GotCalled = 0;
void _Block_object_assign(void *destAddr, const void *object, const int flags) {
printf("_Block_object_assign(dest %p, value %p, flags %x)\n", destAddr, object, flags);
++GotCalled;
}
int recovered = 0;
@interface TestObject : NSObject {
}
@end
@implementation TestObject
- (id)retain {
printf("Whoops, retain called!\n");
exit(1);
}
- (void)finalize {
++recovered;
[super finalize];
}
- (void)dealloc {
++recovered;
[super dealloc];
}
@end
void testRR() {
TestObject *to = [[TestObject alloc] init];
__block TestObject *__weak testObject = to; }
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
GotCalled = 0;
testRR();
if (GotCalled == 1) {
printf("called out to support function on initialization\n");
return 1;
}
printf("%s: Success\n", argv[0]);
return 0;
}