[Issue 13537] Unions may break immutability

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Feb 18 16:30:55 PST 2016


https://issues.dlang.org/show_bug.cgi?id=13537

--- Comment #2 from hsteoh at quickfur.ath.cx ---
Unfortunately, fixing this may prove to be a challenge, because
std.typecons.Rebindable uses a union of (possibly) immutable and mutable fields
in order to achieve rebindability. Arguably, though, some kind of explicit cast
ought to be required in that case.  Either that, or we impose the
non-overlapping restriction only in @safe code, so that @system code can
continue using unions to do black magic with immutability.

--


More information about the Digitalmars-d-bugs mailing list