aboutsummaryrefslogtreecommitdiff
path: root/src/check_builtin.cpp
diff options
context:
space:
mode:
authorjakubtomsu <66876057+jakubtomsu@users.noreply.github.com>2024-11-17 21:02:30 +0100
committerjakubtomsu <66876057+jakubtomsu@users.noreply.github.com>2024-11-17 21:02:30 +0100
commit71880eb1fff836b222fa2e98adecb52b3382edca (patch)
tree180291be50356d9a25e2583005b762617806fca1 /src/check_builtin.cpp
parentb3b276c47388a8a86d003fcda414280ac9687147 (diff)
report error when builtin min/max has 1 (non-type) param
Diffstat (limited to 'src/check_builtin.cpp')
-rw-r--r--src/check_builtin.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp
index 42b9e2180..c86503093 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -3170,6 +3170,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
return false;
}
+ if (ce->args.count <= 1) {
+ error(call, "Too few arguments for 'min', two or more are required");
+ return false;
+ }
bool all_constant = operand->mode == Addressing_Constant;
@@ -3343,6 +3347,11 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
gb_string_free(type_str);
return false;
}
+
+ if (ce->args.count <= 1) {
+ error(call, "Too few arguments for 'max', two or more are required");
+ return false;
+ }
bool all_constant = operand->mode == Addressing_Constant;