Ensure that parameters passed to function call are of the right type.

This commit is contained in:
Stefano Sanfilippo 2015-03-07 14:11:25 +01:00
parent 6725cbaf88
commit c9bff1e64b

View File

@ -399,10 +399,12 @@ bool BitcodeEmitter::emit(FunctionCall const& node) {
}); });
} }
auto param = callee->getArgumentList().begin();
std::vector<llvm::Value*> callargs; std::vector<llvm::Value*> callargs;
for (Expression const* arg: node.getArgs()) { for (Expression const* arg: node.getArgs()) {
GUARDED(arg->emit(this)); 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); d->retval = d->builder.CreateCall(callee, callargs);