[Issue 24098] Safe variable can be initialized from `@system` static constructor.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 22 21:38:33 UTC 2024


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

Nick Treleaven <nick at geany.org> changed:

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

--- Comment #3 from Nick Treleaven <nick at geany.org> ---
> depending on how exactly you interpret "create unsafe values", I guess my `main` function may not violate requirement 2

I think dereferencing doesn't create an unsafe value, the static ctor created
an unsafe pointer, which in turn points to an unsafe value.

> clearly it violates requirement 1 and the preconditions hold (the preconditions do not say anything about the state of global variables).

Yes, I think the preconditions need to mention safe context:

> When it is only called with safe values and safe aliasing

--


More information about the Digitalmars-d-bugs mailing list