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

    <tr>
        <th>Summary</th>
        <td>
            Non-template deduction guides are misformatted
        </td>
    </tr>

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

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

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

<pre>
    Example adapted from https://en.cppreference.com/w/cpp/language/class_template_argument_deduction

Using LLVM style here.

Code:
```
template <class T> struct S {
  S(T);
};
S(char const *) -> S<std::string>;

template <class T> S(T) -> S<T>;
```

Is formatted to:
```
template <class T> struct S {
  S(T);
};
S(char const *)->S<std::string>;

template <class T> S(T) -> S<T>;
```

Mind the spaces removed around the arrow `->`.

Interestingly, a templated deduction guide is handled correctly.

I imagine that it's because clang-format isn't able to distinguish (at the point of parsing the arrow) whether it handles a deduction guide or `function_returning_pointer(args)->templated_member<T>;`.
In the case of deduction guides however, `function_returning_pointer` must be the same identifier as `templated_member` IIUC.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFVEtv2zAM_jXKhUjgyE7cHHxo0xYI0O7SbtdAtmhbnS0ZejTLvx_lvJoW2G4b4MgRJX0PknJp5L54-CX6oUMQUgweJdTW9NB6PziW3jL-SA_qWTUMFmu0qCucVaan6I5-FKaxE7oJosEY6IRzW48EKTxuhW1Cj9pvJcpQeWU0S-5ZcnsYvzulG3h6-vEMzu9JQ0sEs4871kZilHEILZPjM05PJMDS9UgLryx9ICRLTPACLL87bAR4YfzmlfEVS48hlt-f_8fFqhUWKqOdB8bJ9QqmEeuFoJ2XUUF6S8Akl8IXlD_pOHFekF6vzl6bOYwbB7WxvfCxEN78F-dR7r_2_aw0-W0R3CAqdGCxN--UAmFNOK4Ia80O6FyEpddVm2y0p85xnnR2e8bXIOCkTsK59aAJSiIoB63QsqOlyliLle_212igetEojUQsPCjPeO6gxEoEh1DFbp8eykRYmhY9iJK61xuQahQRlGspnTe0I2ofjNIeTA2DsGPLnw3FPO1apLklnqMuR_I_izY2eq-DHoNbiz5YTVDbERttJLONO9bvbH7bY1_S6qUI58xt9CijEuSJpH0ipByZHb5H4PVfmJcJ9IHap8RDCUVPOZZ06VWtyJZw8fwXRXRqs_m-nk1kkcpVuhITr3yHxTejp-fO-iJKWIReufMlmQTbFdcfq0b5NpTHb1TXvZ9e08GaNyo2TZVzASlXj4vFPOOTtuB5VtV4M1-UVVqWXJaY8jpfoMjzpVjyfNKJEjtXsMUd4_xjB9CULe4nquAJ50nG83m2SOfprKznYpXyCldJOc-yhGUJ9kJ1syhlZmwzscWoqgxUtSzpqHHcZZFuk2o04shI-CL41tii_xmsxLfJaKAY1f8GcjPJjg">