Mercurial > projects > ldc
diff gen/toobj.c @ 17:6c6cd097bcdf trunk
[svn r21] * Fixed local instances of imported templates
author | lindquist |
---|---|
date | Wed, 03 Oct 2007 06:14:41 +0200 |
parents | 37a4fdab33fc |
children | c05ef76f1c20 |
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); + } } }