add explicit cast from isize/usize to pointer

closes #91
This commit is contained in:
Andrew Kelley
2016-01-27 12:43:03 -07:00
parent e809baa866
commit 261517aa44
4 changed files with 31 additions and 1 deletions

View File

@@ -428,6 +428,9 @@ static LLVMValueRef gen_cast_expr(CodeGen *g, AstNode *node) {
case CastOpPtrToInt:
add_debug_source_node(g, node);
return LLVMBuildPtrToInt(g->builder, expr_val, wanted_type->type_ref, "");
case CastOpIntToPtr:
add_debug_source_node(g, node);
return LLVMBuildIntToPtr(g->builder, expr_val, wanted_type->type_ref, "");
case CastOpPointerReinterpret:
add_debug_source_node(g, node);
return LLVMBuildBitCast(g->builder, expr_val, wanted_type->type_ref, "");