Mercurial > projects > ldc
changeset 17:6c6cd097bcdf trunk
[svn r21] * Fixed local instances of imported templates
author | lindquist |
---|---|
date | Wed, 03 Oct 2007 06:14:41 +0200 |
parents | 860524276608 |
children | c05ef76f1c20 |
files | gen/toobj.c lib/llvmdcore.bc lib/lphobos.bc test/imports2.d |
diffstat | 4 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/toobj.c Wed Oct 03 05:41:15 2007 +0200 +++ b/gen/toobj.c Wed Oct 03 06:14:41 2007 +0200 @@ -630,7 +630,7 @@ const llvm::FunctionType* functype = llvm::cast<llvm::FunctionType>(llvmValue->getType()->getContainedType(0)); // only members of the current module maybe be defined - if (getModule() == gIR->dmodule) + if (getModule() == gIR->dmodule || parent->isTemplateInstance()) { llvmDModule = gIR->dmodule; @@ -730,5 +730,10 @@ gIR->funcdecls.pop_back(); } + + // template instances should have weak linkage + if (parent->isTemplateInstance()) { + func->setLinkage(llvm::GlobalValue::WeakLinkage); + } } }