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

    <tr>
        <th>Summary</th>
        <td>
            `clang-format` does not correctly order qualifiers in template parameter names
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    If we run `clang-format` on the following file ("`broken_east_const.cpp`"):
```c++
struct A { };

template <typename T>
struct B {
};

struct C {
    B<const A> f() { return {}; }
};
```
like this:
```cmd
clang-format -i -style="{BasedOnStyle: WebKit, QualifierAlignment: Right}" broken_east_const.cpp
```
the file is not changed. However, since qualifiers should be right-aligned, the line
```c++
B<const A> f() { return {}; }
```
should be changed to
```c++
B<A const> f() { return {}; }
```

This came up in the [serenity](https://github.com/SerenityOS/serenity) project, specifically here: [Format.h#L242](https://github.com/SerenityOS/serenity/blob/master/AK/Format.h#L242). The whole project was recently re-formatted in commit [086969277e74d8ba065bf8145d3aeb0dec0bfee5](https://github.com/SerenityOS/serenity/commit/086969277e74d8ba065bf8145d3aeb0dec0bfee5) using the new [`.clang-format` file](https://github.com/SerenityOS/serenity/blob/master/.clang-format) which now specifies the `QualifierAlignment: Right` option.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVE2P0zAQ_TXpxWqUOEmTHHJod6lAICHYlTgi25k0BscOtkPVf8_YbVkWVgtaUbl2_DXvzbzxcNOfujcDOQKxiybJJhOK6cN6MHZiHqfEaOJHIINRyhylPpBBKiAJbRJKcZ9b8xX0Z2DOfxZGO5-Kecb1sEvbpNgm2W2SbcNKbCKhu9DiqvN2EZ5sSVLv8H-bFJeNc-9hmhXziFbc-NMMmk1A7pPi1aPb4eb12h8mLmduHs4Q_O3QYCRLtmiNDNGbNrKw4Ber4_FoLNL60_jVnfNUya-AUZLuCX-n_rzya1zJWpK18ycFSXEbIlXvdsxB_17fnRe35BPwt9In9IZ8WJiSgwSLMAc9gfZh_6M8jD5QopQ8rcFTRKOSQT_piDaeiBFJQZ-S1-YI38EGPCe1APLtiuqIG82iesIxRQLomgUe0IezwZ6SGp4T-WXBfsz7gcKFMfHmb5hbElFfjHnu71FVIkLiLTOR57eQVDsHFrT0p6RCBZrR-zlqT_fYDtKPC0-FmXBydzn4_g4nP28hl9maLyCiwm4GgbEWTKkTGfFMEBhB9jFZ0jGhxTta0pdi7bkyHIcJ8yNIvN--xe5347RNyT06dxwN5seFHTkyhxETmHRIzcIlfz0KgLFA1En6wDRrNu2mpXUNddk3nGWbig9NXlZ9wYBnPYiMDwDVi104Q-HHPyNhiBcX6lVQTMMx0ERt09_rW3gO_y2yj60jheMoxYhP7XgVGdw5hTbZc-861N3ZS6PTVd8VfVu0bOWlV9A9UaF7A5fXbCxqFZQytgf76xsOmXutpjOzmM9ImISC6laLVd0zviv1_TqsfybtXjq3gMOPqqxpvhq7JoOmZbzmRZMPvWiGAkqetzxroQao2UoxDsp1QQZKgyDRRKh-1e1KdjSjNCszmm-qMs_TsuBNVVNaQD8I_E7KDCYmVRp4pMYeVraLlPhycLippPPuYZM5F4oURDi0zxY_GtsJC8wbm-MIM9h8FTl00YcfOXsmYA">