translate-c: enum constants can have incorrect type #9153
Labels
bug
Observed behavior contradicts documented or intended behavior
translate-c
C to Zig source translation feature (@cImport)
Milestone
The following code translates incorrectly due to the underlying int type of an enum type being different from the int type of an enum constant (in the below C code, a variable of type
foo
would have an underlying representation ofunsigned
, but the enum constantbar
has typeint
). In the translated Zig code,bar
has typec_uint
since that is the return type of@enumToInt(enum_foo.bar)
; it should bec_int
This bug was revealed (but not caused by) #8394, I believe the fix is to coerce enum redecls to the correct int type.
The text was updated successfully, but these errors were encountered: