aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorLaytan <laytanlaats@hotmail.com>2024-08-14 11:55:09 +0200
committerGitHub <noreply@github.com>2024-08-14 11:55:09 +0200
commit29a6959a566cea8961e10363df280cb30ca9433b (patch)
tree432bb3f38ab4d955d8555638e6853ae322343d30 /src/check_type.cpp
parent1c8672ac6c939ef9c79173bb609a98b5c5a84a3b (diff)
parentfe268a9dd29a85d7b7a021cd5a0659a8b8300172 (diff)
Merge pull request #2977 from jakubtomsu/disallow-variadic-param-default
Report error when a variadic procedure parameter has a default value
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index 5f456fb31..cbee1d2bd 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -1819,6 +1819,8 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para
if (default_value != nullptr) {
if (type_expr != nullptr && type_expr->kind == Ast_TypeidType) {
error(type_expr, "A type parameter may not have a default value");
+ } else if (is_variadic) {
+ error(type_expr, "A variadic parameter may not have a default value");
} else {
param_value = handle_parameter_value(ctx, type, nullptr, default_value, true);
}