The block definition creates a new scope which seems to interfere with the compiler’s ability to correctly interpret the switch statement.
Adding scope delimiters for each case label resolves the error. I think this is because the block’s scope is now unambiguously a child of the case scope.
switch (buttonIndex) {
case 0:
{
[self updateUserDataWithCompletion:^{
[weakSelf finishEditing];
}];
break;
}
case 1:
{
[self updateOtherDataWithCompletion:^{
[weakSelf finishEditing];
}];
break;
}
default:
break;
}
There’s a bug open with LLVM for a similar issue.