Skip to content

Wrap BinaryOperator in integer cast in C mode#58

Merged
nunoplopes merged 3 commits intoCpp2Rust:masterfrom
lucic71:bool-expressions
May 3, 2026
Merged

Wrap BinaryOperator in integer cast in C mode#58
nunoplopes merged 3 commits intoCpp2Rust:masterfrom
lucic71:bool-expressions

Conversation

@lucic71
Copy link
Copy Markdown
Contributor

@lucic71 lucic71 commented May 3, 2026

In C, comparison and logical binary operations always produce an int where a bool is expected.

For this reason, wrap binary operators in (... as i32) if the type of BinaryOperator is int. ConvertIntegralToBooleanCast will later take care to convert the integer back to boolean.

@nunoplopes nunoplopes merged commit 02d26b8 into Cpp2Rust:master May 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants