Mercurial > projects > ldc
changeset 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 | acd745fbdb66 |
files | gen/functions.cpp gen/llvmhelpers.cpp |
diffstat | 2 files changed, 9 insertions(+), 4 deletions(-) [+] |
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
--- a/gen/llvmhelpers.cpp Wed Feb 04 00:04:09 2009 +0100 +++ b/gen/llvmhelpers.cpp Wed Feb 04 00:50:04 2009 +0100 @@ -826,6 +826,7 @@ // TEMPLATE HELPERS ////////////////////////////////////////////////////////////////////////////////////////*/ +// FIXME: when is this the right one to use instead of Dsymbol::inTemplateInstance() ? bool DtoIsTemplateInstance(Dsymbol* s) { if (!s) return false;