Compile and execute this program: import std.stdio; void main() { goto here; int a=1; { int b=2; { int c=3; { int d=4; here: writefln("%d %d %d %d",a,b,c,d); } } } } Should it be 1,2,3,4? I got 0 4226665 13 4526524
I don't know. That's an interesting case for safe D. In safe D, either the initializers must be executed, or bypassing them must be banned. The code below is an example of memory corruption. But as @safe isn't yet implemented (so far it only checks for use of asm, AFAIK), it's not a bug yet. ----- class Foo { int x; } @safe void foo() { goto xxx; Foo a = new Foo(); xxx: a.x = 8; }
*** This issue has been marked as a duplicate of issue 602 ***