[Issue 2146] Multiple execution of 'static this' defined in template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jun 9 06:22:04 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2146
------- Comment #1 from samukha at voliacable.com 2008-06-09 08:22 -------
'T x = T.init;' in the template should read 'x = T.init;', sorry:
File a:
----
module a;
import b;
alias Foo!(int) foo;
void main()
{
}
----
File b:
----
module b;
import std.stdio;
template Foo(T)
{
T x;
static this()
{
writefln("Initing " ~ T.stringof);
x = T.init; // less trivial initialization here.
}
}
void baz()
{
alias Foo!(int) bar;
}
----
--
More information about the Digitalmars-d-bugs
mailing list