changeset 426:e763821ab244

Disallow delegates to static functions.
author Christian Kamm <kamm incasoftware de>
date Tue, 29 Jul 2008 12:49:14 +0200
parents 944d43f3779f
children f1d37dc5d354
files gen/toir.cpp
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gen/toir.cpp	Tue Jul 29 12:44:28 2008 +0200
+++ b/gen/toir.cpp	Tue Jul 29 12:49:14 2008 +0200
@@ -1828,6 +1828,9 @@
     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());