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

    <tr>
        <th>Summary</th>
        <td>
            `clang-format` does not correctly order templated qualifiers
        </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++
template <typename T>
struct A {
    const T t;
};
```
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++
const T t;
```
should be changed to
```c++
T const t;
```

This came up in the [serenity](https://github.com/SerenityOS/serenity) project, specifically here: [Format.h#L632](https://github.com/SerenityOS/serenity/blob/master/AK/Format.h#L632). 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.

As far as I can tell, this is not a duplicate of #54721 or #53981 because the incorrect formatting does not appear inside a template parameter list.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVNuO2zYQ_Rr5ZWBBou4PevBmazRIgaDdBfoYUOTIYkOJKknF8N93KMu7m8BdFEENwrzqzJk5M9MZeWk_9nBGsMsEUZkIzafTvjd25J62YCbwA0JvtDZnNZ2gVxohYnXEGN131nzF6Qty578IMzkfi3mm83DLmig7RMljlBzCyTpExB7CWE89jrPmnuCyD_4y48RHhOco--V67bxdhIcDRNX2AdBvtQLP4KNsO42qx9f1zdB1q9VXJP7K3WEyyuvJW49hr2Dv_EVjlD0GH6qHB-5Qfp6erocH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