On 2011-01-23 01:14, Andrej Mitrovic wrote:
A workaround:import std.stdio; import std.exception; struct A { int x; this(void* none) { if (none !is null) { enforce(0, "Tried to pass a parameter to A's constructor"); } writeln("in constructor"); // construction from here.. x = 5; } } void main() { auto a = A(null); } I think that would be safe, and closest to a "default" constructor.
A static opCall would be better. See my answer to the original post. -- /Jacob Carlborg