digitalmars.D.bugs - static constructor bug
- Lukas Pinkowski (29/29) Mar 07 2005 There is a problem with static constructors: It seems as prepending this...
- Thomas Kuehne (13/40) Mar 16 2005 -----BEGIN PGP SIGNED MESSAGE-----
There is a problem with static constructors: It seems as prepending this()
directly with static will run the constructor correctly; with an enclosing
static{ this() } the constructor will not be run:
import std.stdio;
class C1
{
static
{
this()
{
writefln("C1 static ctor");
}
}
}
class C2
{
static this()
{
writefln("C2 static ctor");
}
}
int main()
{
return 0;
}
Executing this prog will give me only "C2 static ctor", but not both, as it
should! I'm using Linux DMD version 0.114;
greetings,
Lukas Pinkowski
Mar 07 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Lukas Pinkowski schrieb am Tue, 08 Mar 2005 01:52:02 +0100:
There is a problem with static constructors: It seems as prepending this()
directly with static will run the constructor correctly; with an enclosing
static{ this() } the constructor will not be run:
import std.stdio;
class C1
{
static
{
this()
{
writefln("C1 static ctor");
}
}
}
class C2
{
static this()
{
writefln("C2 static ctor");
}
}
int main()
{
return 0;
}
Executing this prog will give me only "C2 static ctor", but not both, as it
should! I'm using Linux DMD version 0.114;
I thought the "static{ this... }" behavior was documented
somewhere.
Added to DStress as
http://dstress.kuehne.cn/run/static_30.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFCOGKp3w+/yD4P9tIRAppWAJ984EbYbTNkK+dn19KJmUMOBwcwkACfaNH9
lUqXxqJclSRxxlO3MePvz2U=
=HAiY
-----END PGP SIGNATURE-----
Mar 16 2005








Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn>