https://issues.dlang.org/show_bug.cgi?id=12885
Steven Schveighoffer <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #6 from Steven Schveighoffer <[email protected]> --- I just ran into this, with vibe.d Json type. Well, not a problem exactly, I just noticed I happened to be stripping const by accident, and it alarmed me that the compiler lets you get away with it. I will note that this fails: ```d union U { int *p; int i; } void main() { const U c; U m = c; } ``` I see no reason why this should fail but the other should not, the inconsistency itself is a problem. But beyond that, I will note that a struct that contains such an overlapping is convertible from const to mutable in @safe code. This in itself isn't a problem since you can't access the pointer value in @safe code. But surely if you wanted to provide access for @safe callers (like, for a tagged union, like Json), there would be trusted escapes, and those would surely not expect an implicit conversion of a const pointer to a mutable pointer. --
