aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-01-27 17:30:39 -0500
committerAndrew Kelley <andrew@ziglang.org>2020-01-27 17:30:39 -0500
commitc0fee9dfc7be5ab2c232a4787223a8e56a56745b (patch)
tree86983d21004c4dcd0ed10aa72f517ad7521309cd /src/codegen.cpp
parente2778c03e07c23d60861b90474859b9d8a62bce8 (diff)
downloadzig-c0fee9dfc7be5ab2c232a4787223a8e56a56745b.tar.gz
zig-c0fee9dfc7be5ab2c232a4787223a8e56a56745b.zip
fix nested bitcast passed as tuple element
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);