aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 9a58a8c980..ef43ebd575 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -3120,8 +3120,14 @@ static LLVMValueRef ir_render_resize_slice(CodeGen *g, IrExecutableGen *executab
static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutableGen *executable,
IrInstGenCast *cast_instruction)
{
+ Error err;
ZigType *actual_type = cast_instruction->value->value->type;
ZigType *wanted_type = cast_instruction->base.value->type;
+ bool wanted_type_has_bits;
+ if ((err = type_has_bits2(g, wanted_type, &wanted_type_has_bits)))
+ codegen_report_errors_and_exit(g);
+ if (!wanted_type_has_bits)
+ return nullptr;
LLVMValueRef expr_val = ir_llvm_value(g, cast_instruction->value);
ir_assert(expr_val, &cast_instruction->base);