Fix bug where compiler treats uint enums as ints

This commit is contained in:
Tohei Ichikawa
2025-06-24 22:58:00 -04:00
parent 62e797b9d1
commit 8410871cb8
3 changed files with 262 additions and 0 deletions

View File

@@ -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) {