mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-11 05:16:19 +03:00
Fixed array operation codegen when used from imported templates. All array operations are now emitted with template linkage. Fixed #270 .
This commit is contained in:
parent
617861ead4
commit
ca39bb4f4d
3 changed files with 9 additions and 3 deletions
|
@ -275,7 +275,7 @@ Expression *BinExp::arrayOp(Scope *sc)
|
|||
//printf("ftype: %s\n", ftype->toChars());
|
||||
fd = new FuncDeclaration(0, 0, Lexer::idPool(name), STCundefined, ftype);
|
||||
fd->fbody = fbody;
|
||||
fd->protection = PROTprotected;
|
||||
fd->protection = PROTpublic;
|
||||
fd->linkage = LINKd;
|
||||
|
||||
// special attention for array ops
|
||||
|
|
|
@ -1352,6 +1352,12 @@ void DtoOverloadedIntrinsicName(TemplateInstance* ti, TemplateDeclaration* td, s
|
|||
|
||||
bool mustDefineSymbol(Dsymbol* s)
|
||||
{
|
||||
if (FuncDeclaration* fd = s->isFuncDeclaration())
|
||||
{
|
||||
if (fd->isArrayOp)
|
||||
return true;
|
||||
}
|
||||
|
||||
TemplateInstance* tinst = DtoIsTemplateInstance(s);
|
||||
if (tinst)
|
||||
{
|
||||
|
|
|
@ -275,9 +275,9 @@ LLGlobalValue::LinkageTypes DtoLinkage(Dsymbol* sym)
|
|||
assert(fdecl->type->ty == Tfunction);
|
||||
TypeFunction* ft = (TypeFunction*)fdecl->type;
|
||||
|
||||
// array operations are always internal
|
||||
// array operations are always template linkage
|
||||
if (fdecl->isArrayOp)
|
||||
return llvm::GlobalValue::InternalLinkage;
|
||||
return TEMPLATE_LINKAGE_TYPE;
|
||||
// intrinsics are always external
|
||||
if (fdecl->llvmInternal == LLVMintrinsic)
|
||||
return llvm::GlobalValue::ExternalLinkage;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue