From 8410871cb8cc122572ff55ef929f6acd35782677 Mon Sep 17 00:00:00 2001 From: Tohei Ichikawa Date: Tue, 24 Jun 2025 22:58:00 -0400 Subject: Fix bug where compiler treats uint enums as ints --- src/types.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/types.cpp') diff --git a/src/types.cpp b/src/types.cpp index 19df3de9d..0e885afab 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1248,6 +1248,10 @@ gb_internal bool is_type_unsigned(Type *t) { if (t->kind == Type_Basic) { return (t->Basic.flags & BasicFlag_Unsigned) != 0; } + if (t->kind == Type_Enum) { + // TODO(slowhei): Is an enum's base type guaranteed to be TypeKind::Basic? Even if its backing type is implicitly int? + return (t->Enum.base_type->Basic.flags & BasicFlag_Unsigned) != 0; + } return false; } gb_internal bool is_type_integer_128bit(Type *t) { -- cgit v1.2.3