Thread overview
[Issue 24046] static destructors should be allowed in function bodies
Jul 13, 2023
Max Samukha
Jul 14, 2023
RazvanN
July 13, 2023
https://issues.dlang.org/show_bug.cgi?id=24046

Max Samukha <maxsamukha@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxsamukha@gmail.com

--- Comment #1 from Max Samukha <maxsamukha@gmail.com> ---
While I agree that function-local static constructors/destructors should just work, you can work around this bug by wrapping the destructor in a struct.

--
July 14, 2023
https://issues.dlang.org/show_bug.cgi?id=24046

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #2 from RazvanN <razvan.nitu1305@gmail.com> ---
Maybe an alternative would be for the compiler to automatically call the destructor of all static variables once the program ends.

--
December 13
https://issues.dlang.org/show_bug.cgi?id=24046

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/20312

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--