Bug 17073 – [Reg 2.071.0] Priority clash with `void` default initialization of struct fields
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-01-08T14:10:00Z
Last change time
2017-01-16T23:26:30Z
Assigned to
nobody
Creator
joseph.wakeling
Comments
Comment #0 by joseph.wakeling — 2017-01-08T14:10:13Z
If a struct field is default-initialized to `void` then this will override any later default initialization of a whole instance of that struct.
For example, in the following code:
//////////////////////////////
struct Inner
{
uint alpha = void;
uint beta = 66;
}
struct Outer
{
Inner inner = Inner(23, 99);
}
void main ()
{
import std.stdio : writeln;
Outer outer;
outer.inner.writeln;
}
//////////////////////////////
... the result with dmd is that `outer.inner` is `Inner(0, 99)` instead of the expected `Inner(23, 99)`.
Compiling with e.g. LDC produces the expected result of `Inner(23, 99)`.
Note, the issue still appears even if DMD is used with the same frontend version as LDC. This therefore appears to be a DMD backend issue.