Thread overview
[Issue 4338] Structs with non-const destructors cannot be used as const parameters
Nov 13, 2014
Walter Bright
Jun 14, 2015
Marc Schütz
Jul 25, 2017
ag0aep6g@gmail.com
Aug 15, 2022
RazvanN
November 13, 2014
https://issues.dlang.org/show_bug.cgi?id=4338

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com
           Hardware|Other                       |All
                 OS|Windows                     |All

--
June 14, 2015
https://issues.dlang.org/show_bug.cgi?id=4338

Marc Schütz <schuetzm@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schuetzm@gmx.net

--- Comment #8 from Marc Schütz <schuetzm@gmx.net> ---
See also http://forum.dlang.org/post/rrovaoyaozwnztsedtjt@forum.dlang.org

--
July 25, 2017
https://issues.dlang.org/show_bug.cgi?id=4338

ag0aep6g@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g@gmail.com

--- Comment #9 from ag0aep6g@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.

--
August 15, 2022
https://issues.dlang.org/show_bug.cgi?id=4338

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |LATER

--- Comment #10 from RazvanN <razvan.nitu1305@gmail.com> ---
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.

--