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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] Reference qualifier & after template instantiation in generic lambda parameter list is formatted as binary operator
        </td>
    </tr>

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

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

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

<pre>
    `clang-format` produces incorrect spacing around `&` when it appears after a
template instantiation inside a generic lambda parameter list.

**Repro (`repro.cpp`):**
```cpp
template <auto...> struct S
{
};
auto f = []<auto... A>(S<A...>& c) {};
```

**Config (`.clang-format`):**
```yaml
BasedOnStyle: LLVM
PointerAlignment: Left
```

**Command:**
```
clang-format repro.cpp
```

**Expected (clang-format 19.1.2):**
```cpp
auto f = []<auto... A>(S<A...>& c) {};
```

**Actual:**
```cpp
auto f = []<auto... A>(S<A...> & c) {};
```

It looks like the `&` token is being classified as `TT_BinaryOperator` instead of `TT_PointerOrReference`, so `PointerAlignment` / `ReferenceAlignment` have no effect. The regression appears to come from changes in `determineStarAmpUsage()` in `clang/lib/Format/TokenAnnotator.cpp` between the `llvmorg-19.1.2` tag and current main.

Workaround: `// clang-format off` around the affected line.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VM1u6zYTfRp6M4ggU7YSLbRQfgx8wP2Q4iZtl8WIHMmsKVIlKd_67YuR5SRum4suWoBIZHB-D885GKPpHVEttvdi-7jCKe19qNHp08FbH_1x1Xp9qkWZK4uuv-l8GDCJMocxeD0pimCc8iGQShBHVMb1gMFPToMocyFLjv22JwcmAY4jYYiAXaIAKPIm0TBaTATGxYQuGUzGO_5lNAFCT46CUWBxaDXCiAEH4mRrYspE3vCRfL7SGDwIeSfKPPB3psZxHqESxRLDwWV-Pnz7ob8oHnBKPssyUTxBTGFSCV444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