Fixed problem with static ctors, in templated imported classes, not begin run. Fixes #203

This commit is contained in:
Tomas Lindquist Olsen 2009-02-04 00:50:04 +01:00
parent bd4f7ec731
commit 584911ad4e
2 changed files with 9 additions and 4 deletions

View file

@ -546,12 +546,16 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
}
// static ctor
if (fdecl->isStaticCtorDeclaration() && fdecl->getModule() == gIR->dmodule) {
gIR->ctors.push_back(fdecl);
if (fdecl->isStaticCtorDeclaration()) {
if (fdecl->getModule() == gIR->dmodule || fdecl->inTemplateInstance()) {
gIR->ctors.push_back(fdecl);
}
}
// static dtor
else if (fdecl->isStaticDtorDeclaration() && fdecl->getModule() == gIR->dmodule) {
gIR->dtors.push_back(fdecl);
else if (fdecl->isStaticDtorDeclaration()) {
if (fdecl->getModule() == gIR->dmodule || fdecl->inTemplateInstance()) {
gIR->dtors.push_back(fdecl);
}
}
// we never reference parameters of function prototypes