translate-c applies bitwise NOT to bool, causing type error in Zig #23987
Labels
bug
Observed behavior contradicts documented or intended behavior
translate-c
C to Zig source translation feature (@cImport)
Milestone
Zig Version
0.14.0-dev.3271+bd237bced
Steps to Reproduce and Observed Behavior
C reproducer:
Zig
translate-c
translates C expressions involving bitwise NOT (~
) on boolean results directly as~bool
, which causes a compile-time error:Expected Behavior
translate-c
should coerce the boolean to an integer type (e.g.,@intFromBool(...)
) before applying bitwise operations, to preserve C's implicit promotion rules and avoid Zig type errors. Will close this if it's a dupe.The text was updated successfully, but these errors were encountered: