CTFE Assignment to anonymous union shows unexpected behavior
Rekel
paultjeadriaanse at gmail.com
Fri Apr 23 10:35:44 UTC 2021
On Friday, 23 April 2021 at 00:55:50 UTC, H. S. Teoh wrote:
> [...]
> If you read the field during CTFE. I've never tested
> initializing a union in CTFE then reading it at runtime,
> though. Not sure exactly what would happen in that case.
>
>
> T
I'm not referring to reading non-initial variables, though Im
surprised that's not possible?
In any case, it seems assigning values doesn't work during CTFE
either ... And that is very disappointing to me to be quite
honest...
This only seems to happen when I use CTFE to create a static
singleton of the union by assigning to non-initial variables, I
couldn't find anything in the docs that say I shouldn't, I might
have missed something...
I really hope this is a bug... if its not, & assuming its not
inevitable, this really shouldn't be a thing. Be it by design or
limitation.
More information about the Digitalmars-d-learn
mailing list