[clang-tools-extra] [clang-tidy] Correcting fix suggestion in `readability-simplify-boolean-expr` (PR #178392)
Björn Svensson via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 5 00:46:00 PST 2026
================
@@ -162,7 +162,8 @@ static std::string replacementExpression(const ASTContext &Context,
if (const auto *EC = dyn_cast<ExprWithCleanups>(E))
E = EC->getSubExpr();
- const bool NeedsStaticCast = needsStaticCast(E);
+ const bool NeedsStaticCast =
+ Context.getLangOpts().CPlusPlus && needsStaticCast(E);
----------------
bjosv wrote:
Also, `bool` is an integer type in C23 ([6.3.1.1](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf) in the public draft),and
all integer types can be implicitly converted to other integer types under the standard conversion rules (§6.3),
then converting from bool to an integer type (e.g., int, unsigned, etc.) does not require an explicit cast according to the normal conversion model of the language.
https://github.com/llvm/llvm-project/pull/178392
More information about the cfe-commits
mailing list