Translate-C doesn't understand that bool is a one-bit unsigned integer #22923
Labels
bug
Observed behavior contradicts documented or intended behavior
translate-c
C to Zig source translation feature (@cImport)
Zig Version
0.14.0-dev.2851+b074fb7dd
Steps to Reproduce and Observed Behavior
In the C standard, the "bool" type is specified to be a one-bit, unsigned integer, and boolean constants "true" and "false" are specified to be one and zero, respectively. Thus, a bool variable or constant can be used as an array subscript, and can be cast to and from other integer types.
So, this C program is well defined, and compiles and runs warning- and error-free:
But translate-c produces zig code that fails to compile:
Expected Behavior
Resulting zig code should compile and run, producing:
The text was updated successfully, but these errors were encountered: