https://issues.dlang.org/show_bug.cgi?id=12118

Nick Treleaven <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #5 from Nick Treleaven <[email protected]> ---
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("");

--

Reply via email to