Mercurial > projects > ldc
diff gen/functions.cpp @ 934:b56f3571c450
Fixed problem with static ctors, in templated imported classes, not begin run. Fixes #203
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 04 Feb 2009 00:50:04 +0100 |
parents | d3a6f1a96731 |
children | cac9895be400 |
line wrap: on
line diff
--- a/gen/functions.cpp Wed Feb 04 00:04:09 2009 +0100 +++ b/gen/functions.cpp Wed Feb 04 00:50:04 2009 +0100 @@ -546,12 +546,16 @@ } // 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