<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57160>57160</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
space removed after auto keyword, clang-format 14 regression
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JohnC32
</td>
</tr>
</table>
<pre>
Given:
```c++
struct Foo {
static constexpr auto (A::*f)() const = &A::start;
};
static auto toFile = [](auto const& f) -> auto {
auto p = f->getP();
return xp(p);
};
```
and `_clang-format`:
```yaml
---
BasedOnStyle: Google
IndentWidth: 4
...
```
Running clang-format 13 gives the expected answer (same as above).
Running clang-format 14 gives:
```c++
struct Foo {
static constexpr auto(A::*f)() const = &A::start;
};
static auto toFile = [](auto const& f) -> auto{
auto p = f->getP();
return xp(p);
};
```
Notice the space after the `auto` keyword has been removed when a '(' or '{' follows the auto. Seems
like clang-format 14 is incorrectly treating auto as a non-keyword, perhaps a user function?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVEtvnDAQ_jVwGYFY89o9cEiy3ag9tFVz6DEyMIAbYyPbZLP_voPZJKumj0srdWWxngfffDPziVq3p-pWPKIK0qsg2QfJ87NI1tME7Ho53mudmRsHB60hKM8-oJ913IkGGq2sw6fJAJ8dpbDt1QJLh111AduRg55rGgTpnjKKcwYhGBekZ8yg3L_ez5V9BY_r9EFIXAHy6yDfE64PeGDChKUYREH67kzkkqv3TP7tbknp0X1eib2UXNIMutkoeJooNl0G33J7mdWlk6sWyHXfSK76qNNm5G5J-cWYT3yUqyuKovVyzS22n9SdO0mk1-BW655uPvZetajcV9G6YQllqzeO498w-jIrJVQPl4xgk0JP67fgBgRaHTYOW-DKHtEsC7R8ROAWeK0fkcYQ_xkxWxH_vqD-Fz39Ozn9bG0fNRFFvx87cbrxztFuFpsyPZ8igQc8HbVpYaBd1YiKCo60sRaOAxmcJlN6ViVo4w3qgYxOS6mP6_YXqBjuEEe7VpbiAd_sVlgQqtHGkFLkCZxBGiRpwM9hEQooraIznYDdwIRm4NMSmC3x7mbVOKHpe3NYq4RYbYoiyctdliZhW6XtLt3x0AknsVo7fu5l7dxXuijwI0ODvUFrqUY4G1kNzk1ejOxApxdumOu40SMZUj4-_0WT0d-oJTKFtTPJlx3yclMk4VA1W2y3u7LINqxsdgkS001CvrzEFFlRh5LXKG21iIcxhUfwEHQnLYWiYgljyXaTE1qaJ3HKWF1u86zcdFmbcB5kCY5cyHjhEWvTh6bylOq5txSUwjr7GuTUWq8Qq1WrIY1j0Kb6oAd1k7LQl6489e-zuLEa">