diff --git a/BitcodeEmitter.cpp b/BitcodeEmitter.cpp index 7786088..bf8f9c4 100644 --- a/BitcodeEmitter.cpp +++ b/BitcodeEmitter.cpp @@ -399,10 +399,12 @@ bool BitcodeEmitter::emit(FunctionCall const& node) { }); } + auto param = callee->getArgumentList().begin(); std::vector callargs; for (Expression const* arg: node.getArgs()) { GUARDED(arg->emit(this)); - callargs.push_back(d->retval); + callargs.push_back(coerce(d, d->retval, param->getType())); + ++param; } d->retval = d->builder.CreateCall(callee, callargs);