[Issue 14650] Destructors are not called on global variables
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jan 6 01:19:24 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=14650
Jonathan M Davis <issues.dlang at jmdavisProg.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |issues.dlang at jmdavisProg.co
| |m
--- Comment #4 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
Yeah, 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.
--
More information about the Digitalmars-d-bugs
mailing list