mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Do not do certain implicit conversions on enums in binary expression.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user