www.digitalmars.com         C & C++   DMDScript  

D - about static constructor in template

reply yaneurao <yaneurao_member pathlink.com> writes:
static constructor in other module's template never called.
is it a bug or not?

--- other_module.d
template template_test(T) {
static this() { printf("static constructor\n"); }
class foo { static this() { printf("foo's static constructor\n"); } }
static foo t;
}

--- test.d
import other_module;
class foo {}

int main(){
instance template_test(foo) f;
while(1) {}
return 0;
}

/**
compiled with
dcd test.d other_module.d
in windows
*/
Dec 02 2003
parent "Walter" <walter digitalmars.com> writes:
"yaneurao" <yaneurao_member pathlink.com> wrote in message
news:bqingn$2m7o$1 digitaldaemon.com...
 static constructor in other module's template never called.
 is it a bug or not?
Bug.
Dec 19 2003