aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-10-21 15:46:04 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-10-21 15:46:04 -0400
commita1af7cbf007f61e8fea06e1497b93c05bd989e74 (patch)
treee77c62d66501469563a0490689c0892dbf630cba /src/ir.cpp
parent175893913defb637fd14ea5d2b49bbdf79a3222d (diff)
downloadzig-a1af7cbf007f61e8fea06e1497b93c05bd989e74.tar.gz
zig-a1af7cbf007f61e8fea06e1497b93c05bd989e74.zip
report compile error instead of crashing for void in var args
See #557
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 2c2a8d282d..0879942b3e 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -10369,7 +10369,11 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
arg_tuple_i < arg->value.data.x_arg_tuple.end_index; arg_tuple_i += 1)
{
VariableTableEntry *arg_var = get_fn_var_by_index(parent_fn_entry, arg_tuple_i);
- assert(arg_var != nullptr);
+ if (arg_var == nullptr) {
+ ir_add_error(ira, arg,
+ buf_sprintf("compiler bug: var args can't handle void. https://github.com/zig-lang/zig/issues/557"));
+ return ira->codegen->builtin_types.entry_invalid;
+ }
IrInstruction *arg_var_ptr_inst = ir_get_var_ptr(ira, arg, arg_var, true, false);
if (type_is_invalid(arg_var_ptr_inst->value.type))
return ira->codegen->builtin_types.entry_invalid;