[clang] [clang-format] Make some binary operations imply requires clause (PR #110942)

Emilia Kond via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 00:32:53 PDT 2024


================
@@ -3528,6 +3528,17 @@ bool UnwrappedLineParser::parseRequires() {
         return false;
       }
       break;
+    case tok::equalequal:
+    case tok::greaterequal:
+    case tok::lessequal:
+    case tok::r_paren:
+    case tok::pipepipe:
+      if (OpenAngles == 0) {
+        FormatTok = Tokens->setPosition(StoredPosition);
+        parseRequiresClause(RequiresToken);
+        return true;
+      }
+      break;
----------------
rymiel wrote:

What about the original issue but with an r-value ref-qualifier instead of an l-value one:
```c++
template <int n> struct S
{
  void f() && requires(n == 1) {}

  // some comment
  void g() {}
};
```

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


More information about the cfe-commits mailing list