comparison gen/toir.cpp @ 426:e763821ab244

Disallow delegates to static functions.
author Christian Kamm <kamm incasoftware de>
date Tue, 29 Jul 2008 12:49:14 +0200
parents c8d98ccad0cc
children b5f55f471e0b
comparison
equal deleted inserted replaced
425:944d43f3779f 426:e763821ab244
1826 DValue* DelegateExp::toElem(IRState* p) 1826 DValue* DelegateExp::toElem(IRState* p)
1827 { 1827 {
1828 Logger::print("DelegateExp::toElem: %s | %s\n", toChars(), type->toChars()); 1828 Logger::print("DelegateExp::toElem: %s | %s\n", toChars(), type->toChars());
1829 LOG_SCOPE; 1829 LOG_SCOPE;
1830 1830
1831 if(func->isStatic())
1832 error("can't take delegate of static function %s, it does not require a context ptr", func->toChars());
1833
1831 const LLPointerType* int8ptrty = getPtrToType(LLType::Int8Ty); 1834 const LLPointerType* int8ptrty = getPtrToType(LLType::Int8Ty);
1832 1835
1833 LLValue* lval = new llvm::AllocaInst(DtoType(type), "tmpdelegate", p->topallocapoint()); 1836 LLValue* lval = new llvm::AllocaInst(DtoType(type), "tmpdelegate", p->topallocapoint());
1834 1837
1835 DValue* u = e1->toElem(p); 1838 DValue* u = e1->toElem(p);