[Bug c/52946] New: Unable to define a Block variable

lunfis at gmx dot de gcc-bugzilla@gcc.gnu.org
Thu Apr 12 11:20:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52946

             Bug #: 52946
           Summary: Unable to define a Block variable
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lunfis@gmx.de


when defining a 'block' variable using valid syntax (test.c):

#include <stdio.h>

int main (int argc, const char * argv[]) {  

  int (^myBlock)(int) = ^(int num) {
      return num;
      };

  printf("Result is %d\n", myBlock(3));

  return 0;  
}  

"gcc test.c" gives error message: "test.c:5:8: error: expected identifier or
‘(’ before ‘^’ token"

This compiles and executes correctly with gcc 4.2.



More information about the Gcc-bugs mailing list