[cfe-commits] r56595 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/SemaExpr.cpp test/Sema/block-call.c test/Sema/block-return.c
Mike Stump
mrs at apple.com
Thu Sep 25 11:49:41 PDT 2008
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.
More information about the cfe-commits
mailing list