-
-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Destructors are not called on global variables #18998
Labels
Comments
verylonglogin.reg commented on 2015-06-04T12:14:26ZIn case this is an expected behavior (as written in issue 6437, comment 3), please provide reasons and link to documentation. |
andrei (@andralex) commented on 2017-12-07T16:49:13ZDestructors are not called on function static objects, either. Seb, can you please check whether the language reference specifies that? Thanks! |
dfj1esp02 commented on 2017-12-08T10:48:32ZWell, it will have the same problems as static constructors. |
issues.dlang (@jmdavis) commented on 2018-01-06T01:19:24ZYeah, I just tested this after a discussion static variables and their liftemos on D.Learn
-------------------
import std.stdio;
struct S
{
this(string foo)
{
_foo = foo;
}
~this()
{
writefln("%s destroyed", _foo);
}
string _foo;
}
void main()
{
static mainStatic = S("main");
auto s = S("local");
f();
}
void f()
{
static fStatic = S("f");
}
-------------------
It just prints out
local destroyed
The variables for the static destructors are never called. |
schveiguy (@schveiguy) commented on 2018-01-06T01:27:58ZNot calling destructors of thread-local variables at the end of the program could potentially be considered expected behavior.
But not calling them at the end of thread termination is a big problem. As D gets closer to reference counting, sane destruction calls are going to become more and more important. |
razvan.nitu1305 commented on 2018-12-27T13:01:11ZPR: https://github.com/dlang/dmd/pull/9151 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Denis Shelomovskii (@denis-sh) reported this on 2015-06-04T12:08:05Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=14650
CC List
Description
The text was updated successfully, but these errors were encountered: