How can I get the initial value of an arbitrary type? Since any struct can override it, .init is not reliable:

struct Z {
        enum init = 6;
        string val = `asdf`;
};
assert(Z.init == 6);
assert(typeof(Z()).init == 6);

I know I could use
*(cast(Z*) typeid(Z).initializer.ptr)
but that doesn't work in CTFE (because the typeinfo doesn't exist yet).

Z() is obviously not reliable either since it can override static opCall.

Reply via email to