This may be a manifestation of bug 1528. In the code below how
can I heap allocate a default S? I can't seem to get a call to
work.
In general structs are stack objects, but is there any problem
with using the heap to get one?
Thanks
Dan
----------------------------------
import std.stdio;
import std.traits;
struct T { int t; }
struct S {
T[] ts;
this(U)(U[] values...) if (isImplicitlyConvertible!(U, T)) {
foreach (value; values) {
ts ~= value;
}
}
this(this) {
ts = ts.dup;
}
}
void main() {
S s2;
S s = S(T(1), T(2), T(3));
S *sp = new S(T(8)); // fine
S *sp2 = new S([T(2430)]); // fine
// No: template thisstuff.S.__ctor does not match any function
template declaration
// S *sp3 = new S;
// Same - here but also 'no constructor for S'
// S sp3 = new S([]);
// Same
// S sp3 = new S();
}