Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
933:d3a6f1a96731 | 934:b56f3571c450 |
---|---|
544 if (fdecl->isMain()) { | 544 if (fdecl->isMain()) { |
545 gIR->mainFunc = func; | 545 gIR->mainFunc = func; |
546 } | 546 } |
547 | 547 |
548 // static ctor | 548 // static ctor |
549 if (fdecl->isStaticCtorDeclaration() && fdecl->getModule() == gIR->dmodule) { | 549 if (fdecl->isStaticCtorDeclaration()) { |
550 gIR->ctors.push_back(fdecl); | 550 if (fdecl->getModule() == gIR->dmodule || fdecl->inTemplateInstance()) { |
551 gIR->ctors.push_back(fdecl); | |
552 } | |
551 } | 553 } |
552 // static dtor | 554 // static dtor |
553 else if (fdecl->isStaticDtorDeclaration() && fdecl->getModule() == gIR->dmodule) { | 555 else if (fdecl->isStaticDtorDeclaration()) { |
554 gIR->dtors.push_back(fdecl); | 556 if (fdecl->getModule() == gIR->dmodule || fdecl->inTemplateInstance()) { |
557 gIR->dtors.push_back(fdecl); | |
558 } | |
555 } | 559 } |
556 | 560 |
557 // we never reference parameters of function prototypes | 561 // we never reference parameters of function prototypes |
558 std::string str; | 562 std::string str; |
559 if (!declareOnly) | 563 if (!declareOnly) |