Is this a bug? +goto

MatheusBN m at gmail.com
Mon Nov 5 23:54:59 UTC 2018


Hi,

I posted this in another thread but without any response.

This code:

void main(){
      goto Q;
      int x;
      Q:
      writeln("a");
}

Gives me this error: "source_file.d(4): Error: goto skips 
declaration of variable source.main.x at source_file.d(5)"


Now, if I add a pair of brackets:

void main(){
      {
          goto Q;
          int x;
      }
      Q:
      writeln("a");
}

It works. So Is this a bug?

MatheusBN.


More information about the Digitalmars-d-learn mailing list