Thread overview
[Issue 12118] Modify immutable data using throw
May 24, 2022
Tim
Dec 16, 2022
Dlang Bot
Dec 16, 2022
Nick Treleaven
Dec 16, 2022
Nick Treleaven
Dec 17, 2022
Iain Buclaw
Mar 13, 2023
Dlang Bot
May 24, 2022
https://issues.dlang.org/show_bug.cgi?id=12118

Tim <tim.dlang@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe

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

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 #14706 "Fix Issue 12118 - Modify immutable data using throw" fixing this issue:

- Fix Issue 12118 - Modify immutable data using throw

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

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

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #5 from Nick Treleaven <nick@geany.org> ---
comment #0:
> It is possible to throw an immutable Exception and catch it as mutable

Also, the exception is mutated when thrown so that is another safety violation if immutable: https://github.com/dlang/dmd/blob/v2.101.1/druntime/src/rt/deh.d#L13-L21

comment #3:
> At least, defining immutable constructor in derived classes of Throwable should be disallowed.

That wouldn't disallow:

throw new immutable Exception("");

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

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=21415

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--
March 13, 2023
https://issues.dlang.org/show_bug.cgi?id=12118

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

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

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #14706 "Fix Issue 12118 - Modify immutable data using throw" was merged into master:

- 5e7700af332f69bcb887b558b421f29cfd4da21e by Nick Treleaven:
  Fix Issue 12118 - Modify immutable data using throw

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

--