aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-09-03 00:04:12 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-09-03 00:04:12 -0400
commit95636c7e5ff6ad0eeb768a2a0a1d7533b5872e20 (patch)
treebface1d6e36b3830f0229efcaf73d20bc3480f05 /src/codegen.cpp
parent92f747435930bc4d54114e414b372c7eafe7cc02 (diff)
downloadzig-95636c7e5ff6ad0eeb768a2a0a1d7533b5872e20.tar.gz
zig-95636c7e5ff6ad0eeb768a2a0a1d7533b5872e20.zip
ability to @ptrCast to *void
fixes #960
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 388a1a371f..298e89579f 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -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, "");
}