On Friday, 18 August 2017 at 12:09:04 UTC, kinke wrote:
On Friday, 18 August 2017 at 09:42:25 UTC, Jack Applegame wrote:
For some reason, the LDC default initializes the structure, even if initialization of all its members is specified as void. I believe that this is wrong.

Afaik, this has been brought up multiple times already and is so by design. Every aggregate has an init symbol, omitting that (and accordingly the default initialization of all instances) by initializing each field with void doesn't work. The initialization isn't performed fieldwise, but is a bitcopy of T.init. You can skip initialization of specific instances though - `S s = void;` - but again not if `s` is a field of another aggregate.

Sorry, I forgot some workaround code:

void ResetHandler() {
    Foo foo = void;
    foo.__ctor(10);
    // or: std.conv.emplace(&foo, 10);
}

Reply via email to