diff --git a/gen/arrays.cpp b/gen/arrays.cpp index a25a72de..05620b5f 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -91,7 +91,7 @@ void DtoArrayAssign(llvm::Value* dst, llvm::Value* src) } else { - Logger::cout() << "array assignment type dont match: " << *dst->getType() << '\n' << *src->getType() << '\n'; + Logger::cout() << "array assignment type dont match: " << *dst->getType() << "\n\n" << *src->getType() << '\n'; const llvm::ArrayType* arrty = isaArray(src->getType()->getContainedType(0)); if (!arrty) { diff --git a/gen/toir.cpp b/gen/toir.cpp index 7877ebba..74e2bfa1 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -2079,8 +2079,14 @@ DValue* DelegateExp::toElem(IRState* p) const llvm::Type* int8ptrty = llvm::PointerType::get(llvm::Type::Int8Ty); - assert(p->topexp() && p->topexp()->e2 == this && p->topexp()->v); - llvm::Value* lval = p->topexp()->v->getLVal(); + llvm::Value* lval; + if (p->topexp() && p->topexp()->e2 == this) { + assert(p->topexp()->v); + lval = p->topexp()->v->getLVal(); + } + else { + lval = new llvm::AllocaInst(DtoType(type), "tmpdelegate", p->topallocapoint()); + } llvm::Value* context = DtoGEP(lval,zero,zero,"tmp",p->scopebb()); llvm::Value* castcontext = new llvm::BitCastInst(u->getRVal(),int8ptrty,"tmp",p->scopebb());