public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/52946] New: Unable to define a Block variable
@ 2012-04-12 11:20 lunfis at gmx dot de
  2012-04-12 16:20 ` [Bug c/52946] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: lunfis at gmx dot de @ 2012-04-12 11:20 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/52946] Unable to define a Block variable
  2012-04-12 11:20 [Bug c/52946] New: Unable to define a Block variable lunfis at gmx dot de
@ 2012-04-12 16:20 ` pinskia at gcc dot gnu.org
  2012-04-12 18:40 ` manu at gcc dot gnu.org
  2012-04-13  1:08 ` lunfis at gmx dot de
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-04-12 16:20 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |enhancement

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-04-12 16:19:35 UTC ---
Blocks are not part of GNU GCC at all.
The support for them was not submitted upstream by Apple or reimplemented by
anyone else.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/52946] Unable to define a Block variable
  2012-04-12 11:20 [Bug c/52946] New: Unable to define a Block variable lunfis at gmx dot de
  2012-04-12 16:20 ` [Bug c/52946] " pinskia at gcc dot gnu.org
@ 2012-04-12 18:40 ` manu at gcc dot gnu.org
  2012-04-13  1:08 ` lunfis at gmx dot de
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-12 18:40 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |manu at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-12 18:39:56 UTC ---
Which means that this is a proprietary non-portable extension by Apple. It
doesn't work with other compilers except Apple's. You should really not use it.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/52946] Unable to define a Block variable
  2012-04-12 11:20 [Bug c/52946] New: Unable to define a Block variable lunfis at gmx dot de
  2012-04-12 16:20 ` [Bug c/52946] " pinskia at gcc dot gnu.org
  2012-04-12 18:40 ` manu at gcc dot gnu.org
@ 2012-04-13  1:08 ` lunfis at gmx dot de
  2 siblings, 0 replies; 4+ messages in thread
From: lunfis at gmx dot de @ 2012-04-13  1:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Lund <lunfis at gmx dot de> 2012-04-13 01:08:12 UTC ---
OK, my mistake. I did not realize Apple's gcc was that different.

In case, anyone else comes across this issue, I was able to work around it by
installing clang/LLVM and get the 'blocks' library from here:
https://github.com/mackyle/blocksruntime.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-13  1:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 11:20 [Bug c/52946] New: Unable to define a Block variable lunfis at gmx dot de
2012-04-12 16:20 ` [Bug c/52946] " pinskia at gcc dot gnu.org
2012-04-12 18:40 ` manu at gcc dot gnu.org
2012-04-13  1:08 ` lunfis at gmx dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).