diff --git a/src/compiler/types.c b/src/compiler/types.c index c86b6f860..7121aa581 100644 --- a/src/compiler/types.c +++ b/src/compiler/types.c @@ -1969,7 +1969,6 @@ RETRY_DISTINCT: return NULL; case ALL_INTS: if (type_is_distinct_like(other) && type_underlying_is_numeric(other)) return other; - if (other->type_kind == TYPE_ENUM) return type_find_max_type(type, enum_inner_type(other)->canonical); if (other->type_kind == TYPE_VECTOR) return other; return type_find_max_num_type(type, other); case ALL_FLOATS: diff --git a/test/test_suite/enumerations/enum_inline_shift_conversion.c3t b/test/test_suite/enumerations/enum_inline_shift_conversion.c3t new file mode 100644 index 000000000..19fa94a97 --- /dev/null +++ b/test/test_suite/enumerations/enum_inline_shift_conversion.c3t @@ -0,0 +1,31 @@ +// #target: macos-x64 +module test; + +enum Foo : inline uint +{ + BAR, + ABC, + DEF +} + +const BAZ = (1U << Foo.BAR); + +fn int main() +{ + var $var = 1U << Foo.ABC; + var $var2 = 1U << Foo.DEF; + int a = $var; + int b = $var2; + return 0; +} + +/* #expect: test.ll + +define i32 @main() #0 { +entry: + %a = alloca i32, align 4 + %b = alloca i32, align 4 + store i32 2, ptr %a, align 4 + store i32 4, ptr %b, align 4 + ret i32 0 +} \ No newline at end of file