vsapsai added a comment. In D66831#1650015 <https://reviews.llvm.org/D66831#1650015>, @thakis wrote:
> We're getting a bunch of errors looking like > `../../AppsListViewController.m:11:37: error: incompatible block pointer > types assigning to 'void (^)(__strong id<AppCellProtocol>)' from 'void > (^)(AppCollectionViewCell *__strong)'` on code that looks fairly harmless to > me. It looks something like this: > > @protocol AppCellProtocol <NSObject> ... @end > @interface AppCollectionViewCell : NSObject <AppCellProtocol> ...@enderby > > @interface Cell : NSObject > @property(nonatomic, copy) void (^buttonPressed)(id<AppCellProtocol> cell); > @end > > @implementation Bar > - (void) f { > __weak __typeof(self) weakSelf = self; > cell.buttonPressed = ^(AppCollectionViewCell *pressedCell) { > // ... > }; > } > @end > > > The code doesn't say `__strong` anywhere as far as I can tell; it looks like > regular protocol code. > > Is this expected? That's the intention of the change. When you call `void (^buttonPressed)(id<AppCellProtocol> cell)`, it is only enforced that the argument conforms to `AppCellProtocol`. But you can do cell.buttonPressed = ^(AppCollectionViewCell *pressedCell) { // call some AppCollectionViewCell method not present in AppCellProtocol }; and get unrecognized selector error. The change should help to avoid such situations. Does my reasoning look correct to you? Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66831/new/ https://reviews.llvm.org/D66831 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits