CTFE Assignment to anonymous union shows unexpected behavior

Imperatorn johan_forsberg_86 at hotmail.com
Fri Apr 23 10:36:40 UTC 2021


On Thursday, 22 April 2021 at 22:47:17 UTC, Rekel wrote:
> I'm not sure why this is happening, but after simplifying my 
> code I traced it back to what the title may suggest. The 
> original cause of my issues being summarized by debug print 
> statements returning a union as:
>> [...]
> Even though the nanF should thus be 1.0, 0.0, etc...
>
> [...]

This actually seems to be a bug related to order of declaration.

Try this

---
union
     {
         int[size][size] b;
         int[size * size] a;
     }
---


More information about the Digitalmars-d-learn mailing list