Error instead of assert on delegate literals as constant expressions.

Make function literal linkage internal inside functions and external otherwise.
This commit is contained in:
Christian Kamm
2009-05-27 19:20:18 +02:00
parent e7b3f5415f
commit 7fd43e8bf7
2 changed files with 5 additions and 4 deletions

View File

@@ -2297,7 +2297,11 @@ LLConstant* FuncExp::toConstElem(IRState* p)
LOG_SCOPE;
assert(fd);
assert(fd->tok == TOKfunction);
if (fd->tok != TOKfunction)
{
assert(fd->tok == TOKdelegate);
error("delegate literals as constant expressions are not yet allowed");
}
fd->codegen(Type::sir);
assert(fd->ir.irFunc->func);

View File

@@ -265,9 +265,6 @@ LLGlobalValue::LinkageTypes DtoLinkage(Dsymbol* sym)
// extern(C) functions are always external
else if (ft->linkage == LINKc)
return llvm::GlobalValue::ExternalLinkage;
// Function & delegate literals, foreach bodies and lazy parameters: internal linkage
else if (fdecl->isFuncLiteralDeclaration())
return llvm::GlobalValue::InternalLinkage;
}
// class
else if (ClassDeclaration* cd = sym->isClassDeclaration())