On Sep 25, 2008, at 3:13 AM, steve naroff wrote:
> Thanks!  Unfortunately, this means the following will be considered  
> an error.
>
> void foo() {
>   int (^xx)(const char *s) = ^(char *s) { return 1; };
> }

The pointer version of this is a violation of the C and C++  
standards.  Blocks should be the same way.

> Can you try this on your gcc? (I don't have it handy).

With -ansi -pedantic-errors and pointers, they both error out in gcc.   
As blocks, in C++ it gives an error.  In C, it just swallows it, no  
warning even.  The C behavior is wrong, I filed 6246965 to cover it.   
The C++ behavior is as expected.

> Fariborz said we should treat this the same as function pointer  
> assignments (which is why I made the change...).

Ah, but there is a laxity that I don't think he meant to include.   
Blocks don't need this laxity as there isn't 30 year old dusty deck  
blocks code.  Also, laxity for const violations is, well, a - 
fpermissive type thang.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to