[cfe-dev] Fwd: Objective-C in `goto` label block.

Joe Groff arcata at gmail.com
Fri Feb 22 15:35:04 PST 2013

On Thu, Feb 21, 2013 at 7:24 PM, Hoon Hwangbo <drawtree at me.com> wrote:

> Hello.
> I am testing `goto` with Objective-C (ARC enabled).
> And I discovered Objective-C object cannot be exist under `goto` label.
>                         {
>                                 AA*     a1;                     //
>  Fine.
>                         LABEL3:
>                                 AA*     a2;                     //
>  Compiler error: "Expected expression".
>                         }

This is a quirk of standard C99 grammar that isn't Objective-C specific—a
label must be followed by a *statement*, not a declaration. This code is
invalid C, for instance:

void foo() {
  int x;

Putting an empty statement after the label works around it:

void foo() {
  int x;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130222/affafc47/attachment.html>

More information about the cfe-dev mailing list