[clang] [Clang] omit parentheses in fold expressions with a single expansion (PR #110761)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 06:45:24 PDT 2024


================
@@ -122,35 +122,34 @@ void test() {
 #undef EQ
 }
 
-void (*fn)();
-
-void test2() {
-    if ((fn == test2)) {} // expected-warning {{equality comparison with extraneous parentheses}} \
-                          // expected-note {{use '=' to turn this equality comparison into an assignment}} \
-                          // expected-note {{remove extraneous parentheses around the comparison to silence this warning}}
-    if ((test2 == fn)) {}
+namespace GH101863 {
+void t1(auto... args) {
+  if (((args == 0) or ...)) { }
 }
 
-namespace rdar9027658 {
----------------
erichkeane wrote:

This also shouldn't be removed.

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


More information about the cfe-commits mailing list