Thread overview
[Issue 22606] init differs from ctor call for structs
Dec 20, 2021
anonymous4
Dec 09, 2022
RazvanN
December 19, 2021
https://issues.dlang.org/show_bug.cgi?id=22606

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |moonlightsentinel@disroot.o
                   |                            |rg
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=22562

--
December 20, 2021
https://issues.dlang.org/show_bug.cgi?id=22606

--- Comment #1 from anonymous4 <dfj1esp02@sneakemail.com> ---
You mean you want it for the sake of consistency? FWIW init is now static data that always exists to initialize a variable, but a nested struct needs a dynamic initializer to set the context pointer, init can't do it, but a constructor does it.

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

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |INVALID

--- Comment #2 from RazvanN <razvan.nitu1305@gmail.com> ---
Yes, anonymous4 is right. .init is represented by statically known data. The context pointer has the init value of every other pointer, "null". So in this case, this is a programming mistake.

--