Goto skipping declarations

Ben Jones fake at fake.fake
Fri May 3 19:15:16 UTC 2024


In general, you can't skip a declaration with goto, but it seems 
to be allowed if the declaration you're skipping is labelled... 
Is that expected or an accepts invalid bug?

https://godbolt.org/z/4qx8Pf6G7

```d
void f1(){ //fails with error about skipping a declaration
     int x;
     goto Label;
     int y;
     Label:
     int z;
}

void f2(){ //compiles fine
     int x;
     goto Label;
     Dummy:
     int y;
     Label:
     int z;
}
```


More information about the Digitalmars-d-learn mailing list