[cfe-users] Clang doesn't throw an error about missing return value in block with @try

Honza Dvorsky honza at swiftkey.net
Mon Apr 28 00:50:34 PDT 2014


I just found this today - Clang seems to get confused when a block has @try{} @catch(...){} (Objective-C) statement in a block which has a return value declared, but no return statement actually appears in that block. Example:

int main(int argc, const char * argv[])
{
    id (^iReturnStuff)() = ^id() {
        @try{} @finally{}
    };
    return 0;
}

This shouldn't compile. But it does. Whenever you remove the @try statement, Clang throws an error as it should. Gcc correctly doesn't compile this.

What is it about @try{} that gets it confused?

-- 
Honza Dvorsky
@czechboy0
honzadvorsky.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20140428/e1491994/attachment.html>


More information about the cfe-users mailing list