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.

Reply via email to