[cfe-commits] r65751 - in /cfe/trunk: lib/CodeGen/CGBlocks.cpp test/CodeGenObjC/blocks-unsupported.m

Mike Stump mrs at apple.com
Sun Mar 1 11:06:37 PST 2009


On Mar 1, 2009, at 10:55 AM, Anders Carlsson wrote:
> __block variables don't work. For example
>
> void f()
> {
>  __block int a = 10;
>
>  ^{
>    a = 20;
>  }();
>
>  printf("a is: %d\n", a);
> }
>
> does not work as expected.

$ cat ta.c
#include <stdio.h>

int main()
{
     __block int a = 10;

     ^{
         a = 20;
     }();

     printf("a is: %d\n", a);
     return 0;
}
mrs $ clang -S ta.c -o t.s && gcc -m32 t.s && a.out
a is: 20

Do you expect something different?  :-(



More information about the cfe-commits mailing list