[cfe-dev] Fwd: Objective-C in `goto` label block.
Richard Smith
richard at metafoo.co.uk
Fri Feb 22 15:40:24 PST 2013
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/31186e0f/attachment.html>
More information about the cfe-dev
mailing list