On Wednesday, 1 February 2017 at 23:24:27 UTC, kinke wrote:
It's not that bad. D just doesn't support a default ctor for
structs at all and simply initializes each instance with
T.init. Your `s2` initialization is most likely seen as
explicit default initialization (again with T.init).
Destructing both instances is exactly what should happen.
I was going to add a point about this.
1| S s1;
2| S s2 = S();
The effect of line 1 and 2 are exactly the same - which is that
the lhs ends up with S.init. S.this() should either be called at
line 2, or the syntax of line 2 should be forbidden on the
grounds that default struct ctors cannot be declared.