On Saturday, 20 May 2017 at 15:05:44 UTC, Stefan Koch wrote:
Ah tagging behind the scene is an option, it comes with runtime
cost though.
(I guess you meant compile-time cost)
And tagging would disallow the tricky and very common usecase
of overlaying and int and a float.
This I understand, is heavily used.
So this is allowed by the language spec? Anyway, since
compile-time is harder to debug than run-time that seems to be a
reasonable restriction.
(C++ has this restriction as a general rule: one are only allowed
to read from a union field if it was the most recently written
to.)