[cfe-commits] [PATCH] Treat "int (^x)()" as "int (^x)(void)" instead of a K&R style prototype

Eli Friedman eli.friedman at gmail.com
Sun May 31 17:09:00 PDT 2009


On Sun, May 31, 2009 at 4:52 PM, Douglas Gregor<dgregor at apple.com> wrote:
> Problem #1: Type safety. A block pointer "int (^b)()" creates a block
> pointer that is hard to use properly. For example, bind it to a block
> literal like ^(char x) { ... } and you're already in trouble, since
> the literal expects a char but calling b('x') will promote the char to
> an int (yay, K&R).

We actually do catch that case: "int x();" and "int x(char);" aren't compatible.

I agree with the other points, though.

-Eli



More information about the cfe-commits mailing list