mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-08 11:56:12 +03:00
Fixed problem with static ctors, in templated imported classes, not begin run. Fixes #203
This commit is contained in:
parent
bd4f7ec731
commit
584911ad4e
2 changed files with 9 additions and 4 deletions
|
@ -546,13 +546,17 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
||||||
}
|
}
|
||||||
|
|
||||||
// static ctor
|
// static ctor
|
||||||
if (fdecl->isStaticCtorDeclaration() && fdecl->getModule() == gIR->dmodule) {
|
if (fdecl->isStaticCtorDeclaration()) {
|
||||||
|
if (fdecl->getModule() == gIR->dmodule || fdecl->inTemplateInstance()) {
|
||||||
gIR->ctors.push_back(fdecl);
|
gIR->ctors.push_back(fdecl);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// static dtor
|
// static dtor
|
||||||
else if (fdecl->isStaticDtorDeclaration() && fdecl->getModule() == gIR->dmodule) {
|
else if (fdecl->isStaticDtorDeclaration()) {
|
||||||
|
if (fdecl->getModule() == gIR->dmodule || fdecl->inTemplateInstance()) {
|
||||||
gIR->dtors.push_back(fdecl);
|
gIR->dtors.push_back(fdecl);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// we never reference parameters of function prototypes
|
// we never reference parameters of function prototypes
|
||||||
std::string str;
|
std::string str;
|
||||||
|
|
|
@ -826,6 +826,7 @@ DValue* DtoPaintType(Loc& loc, DValue* val, Type* to)
|
||||||
// TEMPLATE HELPERS
|
// TEMPLATE HELPERS
|
||||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
////////////////////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
|
// FIXME: when is this the right one to use instead of Dsymbol::inTemplateInstance() ?
|
||||||
bool DtoIsTemplateInstance(Dsymbol* s)
|
bool DtoIsTemplateInstance(Dsymbol* s)
|
||||||
{
|
{
|
||||||
if (!s) return false;
|
if (!s) return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue