objC blocks vs C++11 lambda
Xcode allows the use of lambdas to be passed as objC blocks, so the following code compiles and works:
typedef void (^my_handler_t)(bool b);
static void myfunc(bool ok, my_handler_t handler) {
handler(ok);
}
int main() {
myfunc(true, [](bool v){ printf("%d", v); });
}
AppCode complains that the lambda expression is of type void (*)(bool b). (i.e. this is fixed by changing the typedef to void (*my_handler_t)(bool b)). I have existing code that I can't change, and AppCode compiles fine with Clang from AppCode. Is there some way to disable these errors?
thanks,
JP
Please sign in to leave a comment.
Could you please file a bug report for the problem?
http://youtrack.jetbrains.com/issues/OC
Done, thanks. http://youtrack.jetbrains.com/issue/OC-6663