[Issue 11440] New: struct initialization with partially initialized data crashes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 4 11:22:57 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11440

           Summary: struct initialization with partially initialized data
                    crashes
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dbdavidson at yahoo.com


--- Comment #0 from Daniel Davidson <dbdavidson at yahoo.com> 2013-11-04 11:22:54 PST ---
import std.stdio;

struct Y {
  private immutable(int)[] _data;
}

struct CFS {
  double x = 5;
  Y growth;
}

void main() {
  auto s = CFS(1.0);      // crash
  //auto s = CFS(1, Y()); // crash
  //auto s = CFS(1, Y([])); // works
  writeln(s);
}

If x is an int there is no problem.
If s is not accessed there is no problem, so it dies in the writeln call.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list