Thread overview
[Issue 21415] catch immutable exceptions breaks immutable
Nov 22, 2020
Adam D. Ruppe
Nov 23, 2020
Daniel Kozak
Nov 23, 2020
Adam D. Ruppe
Dec 16, 2022
Dlang Bot
Dec 16, 2022
Nick Treleaven
Dec 17, 2022
Iain Buclaw
May 02, 2023
Dlang Bot
November 22, 2020
https://issues.dlang.org/show_bug.cgi?id=21415

--- Comment #1 from Adam D. Ruppe <destructionator@gmail.com> ---
this might be a druntime bug instead of dmd. but i suspect it is both due to too many void* in the interface layer.

--
November 23, 2020
https://issues.dlang.org/show_bug.cgi?id=21415

Daniel Kozak <kozzi11@gmail.com> changed:

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

--- Comment #2 from Daniel Kozak <kozzi11@gmail.com> ---
I would say this one is even worse:

immutable foo = new Exception("omg");

void main() {
        import std.stdio;
        try {
                throw foo;
        } catch(Exception e) {
                e.msg = "broken";
                writeln("caught ", e);
        }
}

--
November 23, 2020
https://issues.dlang.org/show_bug.cgi?id=21415

--- Comment #3 from Adam D. Ruppe <destructionator@gmail.com> ---
Yeah, the immutability being lost destroyed what I was hoping to do with this, so definitely the bigger problem. But it being lost either direction is problematic.

Really a "catch-all" would be `catch(const Throwable)`. Const and immutable objects should NOT be caught by a catch mutable. I realize nobody thinks about this but we probably should start.

An immutable exception can be used without allocation concerns.

--
December 16, 2022
https://issues.dlang.org/show_bug.cgi?id=21415

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@ntrel created dlang/dmd pull request #14707 "Fix Issue 21415 - catch immutable exceptions breaks immutable" fixing this issue:

- Fix Issue 21415 - catch immutable exceptions breaks immutable

https://github.com/dlang/dmd/pull/14707

--
December 16, 2022
https://issues.dlang.org/show_bug.cgi?id=21415

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=12118

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=21415

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
May 02, 2023
https://issues.dlang.org/show_bug.cgi?id=21415

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #14707 "Fix Issue 21415 - catch immutable exceptions breaks immutable" was merged into master:

- c3920edb59ec4bd8dbac63169bee1d37529e70d9 by Nick Treleaven:
  Fix Issue 21415 - catch immutable exceptions breaks immutable

https://github.com/dlang/dmd/pull/14707

--