www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13321] New: Wrong goto skips declaration error

https://issues.dlang.org/show_bug.cgi?id=13321

          Issue ID: 13321
           Summary: Wrong goto skips declaration error
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

Reduced from a post by nrgyzer:


struct Foo {
    this(int) {}
}
void main(string[] args) {
    Foo x;
    if (args.length > 1)
        goto EXIT;
    x = Foo(1);
    EXIT:
}


2.067alpha gives an error message that I think is spurious (rejects-valid):

test.d(7,9): Error: goto skips declaration of variable test.main.__ctmp1 at
test.d(8,12)

--
Aug 18 2014