[Issue 4338] Structs with non-const destructors cannot be used as const parameters
https://issues.dlang.org/show_bug.cgi?id=4338 RazvanN changed: What|Removed |Added Status|NEW |RESOLVED CC||razvan.nitu1...@gmail.com Resolution|--- |LATER --- Comment #10 from RazvanN --- Closing this issue as the code compiles. As Andrei pointed out, it is unsound for this code to compile, however, there is a dedicated bug report for that case. --
[Issue 4338] Structs with non-const destructors cannot be used as const parameters
https://issues.dlang.org/show_bug.cgi?id=4338 ag0ae...@gmail.com changed: What|Removed |Added CC||ag0ae...@gmail.com --- Comment #9 from ag0ae...@gmail.com --- (In reply to Andrei Alexandrescu from comment #6) > Mutable destructors shouldn't apply to objects that were immutable, > otherwise they can mutate immutable objects. Consider: > > struct A { > int* p; > ~this() { *p = 5; } > } > > void main() { > auto p = new immutable(int); > { auto a = immutable(A)(p); } > assert(*p == 0); > } Dedicated issue for that: issue 17682. --
[Issue 4338] Structs with non-const destructors cannot be used as const parameters
https://issues.dlang.org/show_bug.cgi?id=4338 Marc Schütz changed: What|Removed |Added CC||schue...@gmx.net --- Comment #8 from Marc Schütz --- See also http://forum.dlang.org/post/rrovaoyaozwnztsed...@forum.dlang.org --
[Issue 4338] Structs with non-const destructors cannot be used as const parameters
https://issues.dlang.org/show_bug.cgi?id=4338 Walter Bright changed: What|Removed |Added CC||bugzi...@digitalmars.com Hardware|Other |All OS|Windows |All --
[Issue 4338] Structs with non-const destructors cannot be used as const parameters
http://d.puremagic.com/issues/show_bug.cgi?id=4338 Denis Shelomovskij changed: What|Removed |Added CC||verylonglogin@gmail.com --- Comment #7 from Denis Shelomovskij 2012-11-03 16:51:43 MSK --- Consolidated into Issue 8956. Do not close this issue as a duplicate because it is another issue. E.g. it can be closed as WONTFIX if destructors will become qualifier-overloadable. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4338] Structs with non-const destructors cannot be used as const parameters
http://d.puremagic.com/issues/show_bug.cgi?id=4338 Andrei Alexandrescu changed: What|Removed |Added CC||and...@metalanguage.com --- Comment #6 from Andrei Alexandrescu 2012-01-17 21:13:29 PST --- With the current 2.058 from head the code compiles. But it shouldn't because it's unsound. Mutable destructors shouldn't apply to objects that were immutable, otherwise they can mutate immutable objects. Consider: struct A { int* p; ~this() { *p = 5; } } void main() { auto p = new immutable(int); { auto a = immutable(A)(p); } assert(*p == 0); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4338] Structs with non-const destructors cannot be used as const parameters
http://d.puremagic.com/issues/show_bug.cgi?id=4338 --- Comment #5 from Kenji Hara 2011-10-09 04:18:14 PDT --- Postblit has similar problem, see bug 4867. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4338] Structs with non-const destructors cannot be used as const parameters
http://d.puremagic.com/issues/show_bug.cgi?id=4338 --- Comment #4 from Kenji Hara 2011-06-21 06:34:18 PDT --- *** Issue 3606 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4338] Structs with non-const destructors cannot be used as const parameters
http://d.puremagic.com/issues/show_bug.cgi?id=4338 Kenji Hara changed: What|Removed |Added CC||k.hara...@gmail.com --- Comment #3 from Kenji Hara 2011-06-21 06:19:56 PDT --- Now this issue is temporary fixed by calling mutable dtor from const object. See change of declaration.c and Walter's comment. https://github.com/D-Programming-Language/dmd/commit/aef37eb0c8986a508ccf185286465b4cbef8a066#L1R1721 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4338] Structs with non-const destructors cannot be used as const parameters
http://d.puremagic.com/issues/show_bug.cgi?id=4338 Austin Hastings changed: What|Removed |Added CC||ah0801...@yahoo.com --- Comment #2 from Austin Hastings 2010-10-23 23:58:39 PDT --- I stumbled into this problem with a struct having an immutable member. Apparently, any kind of const-ness taints the struct, which prevents calling the destructor. In my case, declaring the destructor const/immutable didn't help. :( Apparently, you can't have struct with immutable members as an "in" parameter, since that does the "const scope" thing, which triggers the destructor, which causes the failure. Also: the "const ~this()" syntax works, but "~this() const" does not, which seems odd since it works for other method names. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4338] Structs with non-const destructors cannot be used as const parameters
http://d.puremagic.com/issues/show_bug.cgi?id=4338 Richard Webb changed: What|Removed |Added CC||we...@beardmouse.org.uk --- Comment #1 from Richard Webb 2010-06-17 02:08:52 PDT --- Same as http://d.puremagic.com/issues/show_bug.cgi?id=3606 ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---