<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/77680>77680</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] parenthesized expression in concept causes && to be misinterpreted as rvalue reference
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          joelhock
      </td>
    </tr>
</table>

<pre>
    The standard sometimes requires parentheses around expressions used in concepts, but they can cause `&&` to be interpreted incorrectly.  See how this example is missing the space after the `&&`:

```cpp
template <typename T>
concept concept1 =
        (!std::derived_from<T, MyClass1>) &&std::derived_from<T, MyClass2>;
```
but similar code with the parenthesized expression switched to come second is formatted correctly:
```cpp
template <typename T>
concept concept1 =
 std::derived_from<T, MyClass2> && (!std::derived_from<T, MyClass1>);
```

```
$ clang-format --version
clang-format version 18.0.0git (https://github.com/llvm/llvm-project.git c053e9f0f4b56a56582ad149a8c89434126eff7f)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyslM-O5CYQxp8GX0pjAf5_8GF3Jn3LKXOPMJTbbLBxKNyznaePsLt3eqOstCNtC7UFpSrq-xX6FJE9L4g9qz6z6iVTW5x86L94dJPXf2WDN9f-dUKgqBajggHyM0Y7I0HAvzcbkGBVAZc4ISGBCn5bDODXNSCR9QvBRmjALqD9onGNxOQzDFuEOOEVtFpAq40QWM2ZrNOqOUQPA4JdIoY1YNwLaB8C6uiuOcAfiDD5N4iTJcCval4dgiWYLZFdzqk20Ko0ghojhn3_eAErPjH-wvj9v-bH0ut6nEScV6ciAiue43XFRc0Ir6z47QjftNw1CWDFyxGB24_JlklB0aSrik8Gg72g-XMMfmbF82uC8Pv12SkikarKDo7mfiZDpozi8396P7aJLNnZOhVAe4PwZuO06_82JvsPPk4I6M1GPaFJ1LWfEQi1X0ziOfowq5j4f6P_ju4XQvtZ1TdIH6f7I1z_fyhL0E4t56dDPzw9XTAkVjchj7FbBESb85yfbUzNTTGulHqTJyZPZxunbci1n5k8OXe5f57W4L-gjnnK0rwqsBv5WA5Vraq6aqUyouxUq9uuLEohaxzHZkxivm86M31huqJTGfai4WUnGiF4NvWilbLDRoluaKTWCquhLIwqGy04H7ois73ksuRCcMl5xbt86LCUZadFUWFr2oqVHGdlXZ7azX04Z5Zow75p6pZnTg3oaPcOKR-hMCmTm4R-VzlsZ2Ild5YivReKNrrdd75LrF5-_E7fPeSwDLq_hsMtZkuPhqEIwkW5DSHgiAEXjdkWXP-x0TB52hUTk6dd9L8BAAD__zUFn-I">