[Issue 15205] Incorrect struct init via union array
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jul 21 19:43:43 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=15205
skocznymr at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |skocznymr at gmail.com
--- Comment #2 from skocznymr at gmail.com ---
Encountered what seems to be the same issue. Reproduces on DMD 2.084.0 and LDC
1.13.0
import std.stdio;
struct Foo
{
static Foo initializedFoo()
{
Foo x;
x.a_array[0] = 1;
return x;
}
union
{
float a;
float[1] a_array;
}
}
Foo bar = Foo.initializedFoo();
void main()
{
writeln(bar.a);
writeln(bar.a_array);
}
returns nan [nan] instead of 1 [1]
--
More information about the Digitalmars-d-bugs
mailing list