================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to