From dd8982db1fd829d539c96294b1a05787eb4045d0 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Tue, 29 Jul 2008 12:49:14 +0200 Subject: [PATCH] Disallow delegates to static functions. --- gen/toir.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gen/toir.cpp b/gen/toir.cpp index 2a96f9ec..9404daf0 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -1828,6 +1828,9 @@ DValue* DelegateExp::toElem(IRState* p) Logger::print("DelegateExp::toElem: %s | %s\n", toChars(), type->toChars()); LOG_SCOPE; + if(func->isStatic()) + error("can't take delegate of static function %s, it does not require a context ptr", func->toChars()); + const LLPointerType* int8ptrty = getPtrToType(LLType::Int8Ty); LLValue* lval = new llvm::AllocaInst(DtoType(type), "tmpdelegate", p->topallocapoint());