I've got this class definition:

```d
class X
{
    this()
    {
        assert(false);
    }

    int x = 3;
}
```

due to internal reasons the constructor would fail at compile time, so I put in an assert(false) here, and I can't add or change any methods in X.

How do I get `3` if I have `X` and field name `"x"` at compile time?

For structs `X.init.x` / `__traits(getMember, X.init, "x")` would work, however for classes it complains about null dereference.

I saw there is __traits(initSymbol), however that one doesn't work at compile time.

Reply via email to