Thread overview
[Issue 22978] Shared destructor is not able change immutable var but shared constructor can
Dec 17, 2022
Iain Buclaw
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=22978

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
March 23
https://issues.dlang.org/show_bug.cgi?id=22978

Nick Treleaven <nick@geany.org> changed:

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

--- Comment #1 from Nick Treleaven <nick@geany.org> ---
`x.o` is immutable. It is by design that `x` itself can be initialized in a shared static constructor. Initializing `x.o` directly is also OK (so long as it is not reassigned, that is not currently enforced though, but it is for a class constructor with immutable fields).

It is correct that the destructor can't mutate immutable data.

--
March 23
https://issues.dlang.org/show_bug.cgi?id=22978

Nick Treleaven <nick@geany.org> changed:

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

--- Comment #2 from Nick Treleaven <nick@geany.org> ---
> that is not currently enforced though

That is issue 24449.

--