Thread overview
[Issue 21675] Unsafe aggregate field initializer causes undefined behavior in @safe code
Mar 03, 2021
anonymous4
Dec 17, 2022
Iain Buclaw
Mar 30
Dlang Bot
March 03, 2021
https://issues.dlang.org/show_bug.cgi?id=21675

anonymous4 <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, safe
           Severity|normal                      |major

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--
November 10
https://issues.dlang.org/show_bug.cgi?id=21675

--- Comment #1 from Paul Backus <snarwin+bugzilla@gmail.com> ---
This would also be fixed by having the compiler infer S.p as a @system variable based on its initializer.

--
March 30
https://issues.dlang.org/show_bug.cgi?id=21675

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

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

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@ntrel created dlang/dmd pull request #16347 "Require @system for field initializers with mutable reference types" fixing this issue:

- Require @system for field initializers with mutable reference types

  Enabled with -preview=unsafeFieldInit.

  Fixes Bugzilla 21675 - Unsafe aggregate field initializer causes undefined
behavior in @safe code

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

--
March 30
https://issues.dlang.org/show_bug.cgi?id=21675

Nick Treleaven <nick@geany.org> changed:

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

--- Comment #3 from Nick Treleaven <nick@geany.org> ---
Although the idea in the comment 2 would fix this, the current pull does not. Sorry for the noise.

--