add compile error for the bug of unable to call var ags at compile time
See #313
This commit is contained in:
parent
a3de550d3b
commit
ffb4852012
@ -8252,6 +8252,13 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
|
|||||||
return ira->codegen->builtin_types.entry_invalid;
|
return ira->codegen->builtin_types.entry_invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fn_proto_node->data.fn_proto.is_var_args) {
|
||||||
|
ir_add_error(ira, &call_instruction->base,
|
||||||
|
buf_sprintf("compiler bug: unable to call var args function at compile time. https://github.com/andrewrk/zig/issues/313"));
|
||||||
|
return ira->codegen->builtin_types.entry_invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (size_t call_i = 0; call_i < call_instruction->arg_count; call_i += 1) {
|
for (size_t call_i = 0; call_i < call_instruction->arg_count; call_i += 1) {
|
||||||
IrInstruction *old_arg = call_instruction->args[call_i]->other;
|
IrInstruction *old_arg = call_instruction->args[call_i]->other;
|
||||||
if (type_is_invalid(old_arg->value.type))
|
if (type_is_invalid(old_arg->value.type))
|
||||||
|
@ -37,6 +37,7 @@ test "runtime parameter before var args" {
|
|||||||
assert(extraFn(10, false) == 1);
|
assert(extraFn(10, false) == 1);
|
||||||
assert(extraFn(10, false, true) == 2);
|
assert(extraFn(10, false, true) == 2);
|
||||||
|
|
||||||
|
// TODO issue #313
|
||||||
//comptime {
|
//comptime {
|
||||||
// assert(extraFn(10) == 0);
|
// assert(extraFn(10) == 0);
|
||||||
// assert(extraFn(10, false) == 1);
|
// assert(extraFn(10, false) == 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user