Blocks are overly-strict about void returns
| Originator: | me | ||
| Number: | rdar://11069896 | Date Originated: | 17-Mar-2012 06:32 PM |
| Status: | Closed | Resolved: | 18-May-2012 12:08 PM |
| Product: | Developer Tools | Product Version: | 4.3.1 (4E1019) |
| Classification: | Other Bug | Reproducible: | Always |
I often find myself using the following construct:
-(void)someAction;
{
if (![obj trySomething])
return NSLog(@"something failed"); // (NSLog returns void)
// ...
}
When I try to Do the same in a block:
void (^blk)(void) = ^{
return NSLog(@"hi");
};
it fails with "error: void block should not return a value". The same error is generated with the simple case of "return (void)0;".
Doing "return (void)0;" works for void functions and void ObjC methods, but not for void blocks. I'd like it to work for blocks too.
19-Apr-2012 07:55 AM Apple Developer Bug Reporting Team :
Engineering has provided the following information:
We believe this issue has been addressed in Xcode 4.4 Developer Preview 3. Please verify with this release, and update your bug report with the results.
Xcode 4.4
Build: 4F155i (for OS X 10.8)
Posted Date: April 18, 2012
https://developer.apple.com/devcenter/mac/index.action
18-May-2012 12:08 PM Apple Developer Bug Reporting Team :
Engineering has provided the following information:
We believe this issue has been addressed in Xcode 4.4 Developer Preview 5. Please verify with this release, and update your bug report with the results.
Xcode 4.4 Build 4F183f
Posted Date: May 16, 2012
https://developer.apple.com/devcenter/mac/index.action
After login, click on the "OS X Mountain Lion" tab.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!