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

Joe Groff arcata at gmail.com
Fri Feb 22 15:43:13 PST 2013


Indeed. I filed http://llvm.org/bugs/show_bug.cgi?id=12828 ages ago but it
got lost in the slipstream.

-Joe


On Fri, Feb 22, 2013 at 3:40 PM, Richard Smith <richard at metafoo.co.uk>wrote:

> On Fri, Feb 22, 2013 at 3:35 PM, Joe Groff <arcata at gmail.com> wrote:
>
>> 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() {
>> foo:
>>   int x;
>> }
>>
>> Putting an empty statement after the label works around it:
>>
>> void foo() {
>> foo:;
>>   int x;
>> }
>>
>
> Ick. We should give a better diagnostic for this.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130222/b8e7c986/attachment.html>


More information about the cfe-dev mailing list