diff --git a/gen/toir.cpp b/gen/toir.cpp index d6247a0d..46b182a2 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -1863,12 +1863,8 @@ DValue* DelegateExp::toElem(IRState* p) DValue* u = e1->toElem(p); LLValue* uval; if (DFuncValue* f = u->isFunc()) { - assert(f->func); - LLValue* contextptr; - if (p->func()->decl == f->func) - contextptr = p->func()->thisArg; - else - contextptr = DtoNestedContext(loc, f->func); + assert(f->func); + LLValue* contextptr = DtoNestedContext(loc, f->func); uval = DtoBitCast(contextptr, getVoidPtrType()); } else {