[clang] [Clang] Warning as error for fold expressions over comparison operators (PR #136836)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 1 05:06:17 PDT 2025


================
@@ -15050,7 +15050,7 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
     ResultTy = CheckCompareOperands(LHS, RHS, OpLoc, Opc);
 
     if (const auto *BI = dyn_cast<BinaryOperator>(LHSExpr);
-        BI && BI->isComparisonOp())
+        !ForFoldExpression && BI && BI->isComparisonOp())
----------------
cor3ntin wrote:

That's just a side effect of looking at the LHS first - I don't think the distinction matters here

https://github.com/llvm/llvm-project/pull/136836


More information about the cfe-commits mailing list