aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-03-24 13:49:51 +0000
committergingerBill <bill@gingerbill.org>2024-03-24 13:49:51 +0000
commitd92767cb7784fab76663a82eb84db680af6ec6f6 (patch)
tree1e5ef5e397868cb02865e1ce5fc467fba4e8cc28 /src
parent670fc70f1f0d8c3e8932e50cbd83e55ee429e02f (diff)
Fix #3226
Diffstat (limited to 'src')
-rw-r--r--src/check_expr.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index bd2c576cf..fd10374c1 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -5830,10 +5830,14 @@ gb_internal CallArgumentError check_call_arguments_internal(CheckerContext *c, A
Operand *variadic_operand = &ordered_operands[pt->variadic_index];
if (vari_expand) {
- GB_ASSERT(variadic_operands.count != 0);
- *variadic_operand = variadic_operands[0];
- variadic_operand->type = default_type(variadic_operand->type);
- actually_variadic = true;
+ if (variadic_operands.count == 0) {
+ error(call, "'..' in the wrong position");
+ } else {
+ GB_ASSERT(variadic_operands.count != 0);
+ *variadic_operand = variadic_operands[0];
+ variadic_operand->type = default_type(variadic_operand->type);
+ actually_variadic = true;
+ }
} else {
AstFile *f = call->file();