From 72d1829fec587a41150963015769317934059fc5 Mon Sep 17 00:00:00 2001 From: kalsprite Date: Sun, 16 Aug 2026 22:08:52 -0700 Subject: [PATCH] #any_int range check constants --- src/check_expr.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index aef69fff7..5dee0cda4 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -6917,7 +6917,12 @@ gb_internal CallArgumentError check_call_arguments_internal(CheckerContext *c, A bool ok = false; if (e && (e->flags & EntityFlag_AnyInt)) { if (o->mode != Addressing_Type && is_type_integer(param_type) && (is_type_integer(o->type) || is_type_enum(o->type))) { - ok = check_is_castable_to(c, o, param_type); + if (o->mode == Addressing_Constant) { + // constants have to fit the parameter + ok = check_representable_as_constant(c, o->value, param_type, &o->value); + } else { + ok = check_is_castable_to(c, o, param_type); + } } } if (!allow_array_programming && check_is_assignable_to_with_score(c, o, param_type, nullptr, param_is_variadic, !allow_array_programming)) {