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

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 23 07:55:35 PDT 2025


================
@@ -7138,6 +7138,11 @@ def warn_consecutive_comparison : Warning<
   "chained comparison 'X %0 Y %1 Z' does not behave the same as a mathematical expression">,
   InGroup<Parentheses>, DefaultError;
 
+def warn_comparison_in_fold_expression : Warning<
+  "comparison in fold expression would evaluate to '(X %0 Y) %0 Z' "
----------------
cor3ntin wrote:

We added that discussion for the previous PR, we concluded it was really not useful!

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


More information about the cfe-commits mailing list