http://d.puremagic.com/issues/show_bug.cgi?id=3978
Summary: Compiler crash on improper struct initialization
Product: D
Version: 2.030
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Paul D. Anderson <[email protected]> 2010-03-16
17:18:14 PDT ---
The following code fragment causes the compiler to crash with the following
useful information:
"dmd.exe has encountered a problem and needs to close. We are sorry for the
inconvenience."
//--------------------
public S s = S();
public struct S {
private int[] a = [ 0 ];
}
//--------------------
I realize the code is incorrect, but I expected an error message, not a
trainwreck.
Adding initializer information solves the problem:
//--------------------
public S s = S([0]); // compiles correctly
public struct S {
private int[] a = [ 0 ];
}
//--------------------
Eliminating the forward reference solves the problem:
//--------------------
public struct S {
private int[] a = [ 0 ];
}
public S s = S(); // compiles correctly
//--------------------
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------