On Thu, Oct 2, 2008 at 10:12 AM, Steve Naroff <[EMAIL PROTECTED]> wrote:
==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Oct  2 12:12:56 2008
> @@ -1286,6 +1286,10 @@
>   if (Init->getType()->isFunctionType())
>     return false;
>
> +  // Allow block exprs at top level.
> +  if (Init->getType()->isBlockPointerType())
> +    return false;
> +

This isn't right; if I'm not mistaken, this will let through anything
with a block pointer type, even if isn't constant, and it will
disallow thing like a block expr cast to a void*.

I'm a bit too tired right now to figure out exactly what the correct
fix is.  Probably block pointers should be sent through
CheckAddressConstantExpression.

Oh, and also, we probably need some more checks on the block itself;
we don't want to allow the following:
int a(int arg_x) {
static void (^global_block)(void) = ^{ printf("arg x is %d\n", arg_x); };
}

-Eli
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to