Thread overview
[Issue 22031] crt_constructor functions can't initialize immutable/const variables
Jun 16, 2021
mipri
Jun 16, 2021
mipri
Mar 03, 2022
Dlang Bot
Dec 02, 2022
Walter Bright
Dec 17, 2022
Iain Buclaw
Jan 15, 2023
Walter Bright
June 16, 2021
https://issues.dlang.org/show_bug.cgi?id=22031

mipri <mipri@minimaltype.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|crt                         |crt_constructor functions
                   |                            |can't initialize
                   |                            |immutable/const variables

--
June 16, 2021
https://issues.dlang.org/show_bug.cgi?id=22031

mipri <mipri@minimaltype.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |betterC

--
March 03, 2022
https://issues.dlang.org/show_bug.cgi?id=22031

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

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

--- Comment #1 from Dlang Bot <dlang-bot@dlang.rocks> ---
@MoonlightSentinel created dlang/dmd pull request #13751 "Fix 22031 - Allow modification of non-mutable in `crt_[con|de]structor`'s" fixing this issue:

- Fix 22031 - Allow modification of non-mutable in `crt_[con|de]structor`'s

  Allow functions marked as `pragma(crt_[con|de]structor)` to modify
  `const` / `immutable` variables, which is currently restricted to
  module ctors / dtors. This enables the use of lazily initialized global
  constants for applications without druntime.

  Such function may not be called at runtime because they might violate
  the guarantees of `const` / `immutable`. Hence it is now an error to
  call a function marked as `pragma(crt_[con|de]structor)`.

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

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

Walter Bright <bugzilla@digitalmars.com> changed:

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

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

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

--
January 15, 2023
https://issues.dlang.org/show_bug.cgi?id=22031

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|---                         |WORKSFORME

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
This is now working in master

--