From 64bb0d1c7d03d0ce3a1643401009c528ec9ac296 Mon Sep 17 00:00:00 2001 From: FourteenBrush <74827262+FourteenBrush@users.noreply.github.com> Date: Fri, 11 Jul 2025 19:38:01 +0200 Subject: Allocate temp array instead of sorting in place --- src/check_builtin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/check_builtin.cpp') diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 70848cec6..041e89afd 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -6941,8 +6941,8 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As return false; } - // sort enum fields in place in ascending order - Array enum_constants = type->Enum.fields; + auto enum_constants = array_make(temporary_allocator(), type->Enum.fields.count); + array_copy(&enum_constants, type->Enum.fields, 0); array_sort(enum_constants, enum_constant_entity_cmp); BigInt minus_one = big_int_make_i64(-1); -- cgit v1.2.3