mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-17 05:13:14 +01:00
Fixed problem with static ctors, in templated imported classes, not begin run. Fixes #203
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -826,6 +826,7 @@ DValue* DtoPaintType(Loc& loc, DValue* val, Type* to)
|
||||
// TEMPLATE HELPERS
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
// FIXME: when is this the right one to use instead of Dsymbol::inTemplateInstance() ?
|
||||
bool DtoIsTemplateInstance(Dsymbol* s)
|
||||
{
|
||||
if (!s) return false;
|
||||
|
||||
Reference in New Issue
Block a user