Skip to content

Commit 68b2cda

Browse files
committed
work
1 parent c72cdf5 commit 68b2cda

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎cpp2rust/converter/converter.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,6 +2457,12 @@ void Converter::ConvertIntegralToBooleanCast(clang::ImplicitCastExpr *expr) {
24572457
auto sub_expr = expr->getSubExpr();
24582458
auto *stripped = sub_expr->IgnoreParenImpCasts();
24592459

2460+
if (auto *enum_type = sub_expr->getType()->getAs<clang::EnumType>();
2461+
enum_type && enum_type->getDecl()->getIntegerType()->isBooleanType()) {
2462+
Convert(sub_expr);
2463+
return;
2464+
}
2465+
24602466
if (auto binop = clang::dyn_cast<clang::BinaryOperator>(stripped)) {
24612467
// Comparisons and logical ops already produces bool, no wrap needed.
24622468
if ((binop->isComparisonOp() || binop->isLogicalOp()) &&

0 commit comments

Comments
 (0)