[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Dlang Bot changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #10 from Dlang Bot --- dlang/dmd pull request #16594 "Fix Bugzilla 12885 - const union wrongly converts implicitly to mutable" was merged into master: - 7531b1ae708a478900984734aec044d4dd38379c by Nick Treleaven: Fix Bugzilla 12885 - const union wrongly converts implicitly to mutable https://github.com/dlang/dmd/pull/16594 --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Dlang Bot changed: What|Removed |Added Keywords||pull --- Comment #9 from Dlang Bot --- @ntrel created dlang/dmd pull request #16594 "Fix Bugzilla 12885 - const union wrongly converts implicitly to mutable" fixing this issue: - Fix Bugzilla 12885 - const union wrongly converts implicitly to mutable https://github.com/dlang/dmd/pull/16594 --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Iain Buclaw changed: What|Removed |Added Priority|P1 |P2 --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Steven Schveighoffer changed: What|Removed |Added Keywords||safe Hardware|x86_64 |All OS|Linux |All --- Comment #8 from Steven Schveighoffer --- Also added safe tag. --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Ate Eskola changed: What|Removed |Added CC||ajiesk...@gmail.com Severity|normal |major --- Comment #7 from Ate Eskola --- As a hole in the type system that allows undefined behaviour in @safe code, I think this needs higher severity. Increasing to major. --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Steven Schveighoffer changed: What|Removed |Added CC||schvei...@gmail.com --- Comment #6 from Steven Schveighoffer --- 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. --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Walter Bright changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=12883, ||https://issues.dlang.org/sh ||ow_bug.cgi?id=19256, ||https://issues.dlang.org/sh ||ow_bug.cgi?id=11257 --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 --- Comment #5 from Walter Bright --- https://github.com/dlang/dmd/pull/9061 --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Walter Bright changed: What|Removed |Added CC||bugzi...@digitalmars.com --- Comment #4 from Walter Bright --- Martin is right. --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Issue 12885 depends on issue 12883, which changed state. Issue 12883 Summary: implicit conversion of struct to mutable via alias this https://issues.dlang.org/show_bug.cgi?id=12883 What|Removed |Added Status|RESOLVED|REOPENED Resolution|INVALID |--- --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Martin Nowak changed: What|Removed |Added CC||c...@dawg.eu --- Comment #3 from Martin Nowak --- I don't fully agree with the reasoning in issue 11257. It seems like casts could be used to bypass const checks for implementations of Rebindable et.al. --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 FeepingCreature changed: What|Removed |Added CC||default_357-l...@yahoo.de Severity|enhancement |normal --- Comment #2 from FeepingCreature --- I just ran into this. This bug breaks std.json quite badly: see https://issues.dlang.org/show_bug.cgi?id=19256 , in which const(JSONValue) implicitly converts to JSONValue, allowing us to mutate JSON objects via a const parameter. This is definitely unacceptable. --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Andrei Alexandrescu changed: What|Removed |Added CC||and...@erdani.com --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Nils changed: What|Removed |Added Status|ASSIGNED|NEW Assignee|nilsboss...@googlemail.com |nob...@puremagic.com --- Comment #1 from Nils --- As issue 12883 has been closed as invalid, I don't have a plan how to go about this. Unassigning from me. --
[Issue 12885] const union wrongly converts implicitly to mutable
https://issues.dlang.org/show_bug.cgi?id=12885 Issue 12885 depends on issue 12883, which changed state. Issue 12883 Summary: implicit conversion of struct to mutable via alias this https://issues.dlang.org/show_bug.cgi?id=12883 What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |INVALID --