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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] Wrong formatting when template variable in last thing before closing parenthesis
        </td>
    </tr>

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

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

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

<pre>
    ```cpp
auto t1 = a<int> + b;
auto t2 = (b) + b;
auto t3 = (a<int>) + b;
auto t4 = (a<int> + 1) + b;
```
is formatted as
```cpp
auto t1 = a<int> + b;
auto t2 = (b) + b;
auto t3 = (a<int>)+b;  // wrong, no spaces around +
auto t4 = (a<int> + 1) + b;
```
https://godbolt.org/z/9K11MrPz9 `clang-format version 20.0.0git (https://github.com/llvm/llvm-project.git 8daf4f16fa08b5d876e98108721dd1743a360326)`
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8k81unTAQhZ9m2FhB9pjfBYvcpGyqSt11PVwP4MoXI9vcqHn6CtL8NOmmqlQJCaH5fDznzEAx2mlh7qA8QXmf0ZZmH7qr5SVlgzc_Oqjk03NeV5C3tCUvkhKg7wWBvrNLAv1JAJ7EAPr0QuBBADYDYPuxrJ_Lrxp_5IqP3AGpd_RLlyBvbRSjDxdKiY2g-Lb6HzwAnnZKCMAesBcPwS8T4J1YvIgrnTkKCn5bzC74Tz7nlNYI-vbposmbwbuU-zAB9o-AfftZqS_h62MrdueOlunmKRdx5RCtXwTKXOZysmm_-Z2cTfM25Gd_Aeyduz6_btbgv_M55fupxtBYjKoaSTZDaZq64rZRsqlRGaPqQpOupMZqj6WSmem0aXVLGXeq1oVuClkW2dw1XGrioqS6NaWidqgMUT2cZaWoZU2Z7VBioVBVqFCWRT4qLluqS6m0GRUZKCRfyLp8b3GPILMxbtwplKpoMkcDu3jsOOLbJABx3_rQHdaGbYpQSGdjiq9KySZ3_B-_HSzvxbd9ss-rZpdJPMy8iMSX1VFicaVgaXAs7CIcxSTSvEMDjz6wODsf98-VAi9p5mhjtgXX_d0UAPvDaATsf3m9dvgzAAD__zMlHoA">