From 87c40b6465e53eadaeed407c2e0873eb7f9057b7 Mon Sep 17 00:00:00 2001 From: Franz Date: Thu, 16 Apr 2026 22:57:20 +0200 Subject: [PATCH] Fix array counts for floats that are exactly representable as ints eg. [1.1e4]int --- src/check_type.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/check_type.cpp b/src/check_type.cpp index 137cdb96f..a0a4bc1f2 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2840,6 +2840,12 @@ gb_internal i64 check_array_count(CheckerContext *ctx, Operand *o, Ast *e) { error(e, "Array count too large, %.*s", LIT(str)); gb_free(a, str.text); return 0; + } else if (o->value.kind == ExactValue_Float) { + u64 u = cast(u64)o->value.value_float; + f64 f = cast(f64)u; + if (f == o->value.value_float) { + return u; + } } }