is this an instance of the 16-byte struct bug

Daniel Davidson nospam at spam.com
Sat Nov 2 05:20:52 PDT 2013


and what is the 16 byte struct bug?

http://forum.dlang.org/post/nqqujtblyvxvtrlsbcpx@forum.dlang.org

import std.datetime;
import std.range;
import std.stdio;

struct DateRate {
   Date date;
   double value = 0.0;
}

struct RateCurve {
   private immutable(DateRate)[] _data;
}

struct CFS {
   double initialValue;
   RateCurve growth;
}

void main() {
   auto s = CFS(1.0);
   // auto s = CFS(1.0, RateCurve()); // crashes
   // auto s = CFS(1.0, RateCurve([])); // works
   writeln(s);
}


More information about the Digitalmars-d mailing list