32 lines · plain
1#include <objc/NSObject.h>2 3@interface Classic : NSObject {4@public5 int _ivar;6}7@end8 9@implementation Classic10- (void)fun {11 // check self12}13 14- (void)run {15 __weak Classic *weakSelf = self;16 ^{17 Classic *self = weakSelf;18 // check idiomatic self19 20 // Use `self` to extend its lifetime (for lldb to inspect the variable).21 [self copy];22 }();23}24@end25 26int main() {27 Classic *c = [Classic new];28 c->_ivar = 30;29 [c fun];30 [c run];31}32