I reduced it down to the following invalid code, which compiles without warnings or errors:
BOOL (^block)();
block = ^BOOL {
@try {
} @catch (...) {
}
};
It looks like as soon as you add an @try statement to a block, the compiler stops enforcing that the block has to return a value. Yikes! In my original code, the @try was hidden inside the definition of the XCTAssert() macro, so an equivalent test case is
BOOL (^block)();
block = ^BOOL {
XCTAssert(2 + 2 == 4);
};
I'm 99% certain this is a Clang bug, but I thought I'd ask first in case any of you rules lawyers can think of a reason this should be valid :)
—Jens
PS: I've got Xcode 7.3, i.e. Apple LLVM version 7.3.0 (clang-703.0.29) Target: x86_64-apple-darwin15.5.0