ability to @ptrCast to *void

fixes #960
This commit is contained in:
Andrew Kelley
2018-09-03 00:04:12 -04:00
parent 92f7474359
commit 95636c7e5f
3 changed files with 17 additions and 2 deletions

View File

@@ -2655,6 +2655,9 @@ static LLVMValueRef ir_render_ptr_cast(CodeGen *g, IrExecutable *executable,
IrInstructionPtrCast *instruction)
{
TypeTableEntry *wanted_type = instruction->base.value.type;
if (!type_has_bits(wanted_type)) {
return nullptr;
}
LLVMValueRef ptr = ir_llvm_value(g, instruction->ptr);
return LLVMBuildBitCast(g->builder, ptr, wanted_type->type_ref, "");
}