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

    <tr>
        <th>Summary</th>
        <td>
            clang-format: `QualifierAlignment` tag breaks constrained auto parameters in function in both clang-format 16 and 17.
        </td>
    </tr>

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

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

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

<pre>
    I’ve recently noticed that the `QualifierAlignment` tag would produce uncompilable code when formatting constrained auto parameters in function declarations/definitions, such as in the code snippet below:
```c++
#include <iostream>

void test(std::integral auto const &a) { std::cout << a << std::endl; }

int main() {
    test(1ul);
    test(1);

    return 0;
}
```

The correct syntax here is either `const std::integral auto&` or `std::integral auto const&`. However, if formatted using `QualifierAlignment: Left`, then `clang-format16` would produce `std::integral const auto& a`, which is not the correct syntax. 
On the other hand, if formatted using `QualifierAlignment: Right`,  then `clang-format17` would again produce `std::integral const auto& a`. 

I realize the `QualifierAlignment` tag is marked unstable on the documentation, but it does the correct thing in most scenarios. Maybe it’s possible to fix the behavior for this case, too?

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVNFu4zYQ_Br6ZXGGRDlS9KAHJzmjV1xRtOgPUORK2h5FGuTSvvTrC0p24gDGtQcIsszl7s4Mh6tipNEhduLhSTy8bFTiyYfuVx-npL6qVEhZbHpvXrsv4rMUj4Vo2xNCQI2O7Ss4z6TRAE-KgScEURd_JGVpIAx7S6Ob0bGoC2A1wtkna-AYvEkaITnt5yNZ1VsE7Q3CeUIHgw-zYiY3gvYuclDk0IBK7OGogpqRMUQgB0Nymsk7MKitCip_RyEPBgdydPn3DDHpCdSSkREunaKj4xEZerT-LKq9KF5EsRd1sT5ayKf8rKuyIqdtMgiieiYfOaCaRfX5El7eJ08GGCML-RjZ5JLVnhzjGJRdw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