Implicitly cast return expressions to the return type of the function.
This commit is contained in:
parent
eca4769534
commit
4037a76c6b
|
@ -235,7 +235,8 @@ BitcodeEmitter::~BitcodeEmitter() {
|
|||
bool BitcodeEmitter::emit(Return const& node) {
|
||||
if (node.getExpression()) {
|
||||
GUARDED(node.getExpression()->emit(this));
|
||||
d->builder.CreateRet(d->retval);
|
||||
llvm::Type *type = d->builder.GetInsertBlock()->getParent()->getReturnType();
|
||||
d->builder.CreateRet(coerce(d, d->retval, type));
|
||||
} else {
|
||||
d->builder.CreateRetVoid();
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user