[svn r21] * Fixed local instances of imported templates

This commit is contained in:
Tomas Lindquist Olsen
2007-10-03 06:14:41 +02:00
parent 8d542addd9
commit b7650a7ae6
4 changed files with 9 additions and 2 deletions

View File

@@ -630,7 +630,7 @@ void FuncDeclaration::toObjFile()
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 @@ void FuncDeclaration::toObjFile()
gIR->funcdecls.pop_back();
}
// template instances should have weak linkage
if (parent->isTemplateInstance()) {
func->setLinkage(llvm::GlobalValue::WeakLinkage);
}
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +1,8 @@
module test;
module imports2;
import std.stdio;
void main() {
writefln("Hello world!"[]);
print(42);
printf("\n");
}