<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60040>60040</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Format] Clang-format misplaces `&` for templated types when confused by macro in class declaration
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
danakj
</td>
</tr>
</table>
<pre>
clang-format produces this (see [godbolt](https://godbolt.org/z/79aYE4dTY)):
```cpp
#define if_clang(x) x
struct if_clang([[clang::trivial_abi]]) S {
template <class T>
void foo(T & t);
};
struct if_clang([[clang::trivial_abi]]) T {
template <class T>
void foo(int& t);
};
```
Specifically
```cpp
void foo(T & t);
```
should be
```cpp
void foo(T& t);
```
as it is for
```cpp
void foo(int& t);
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykk8tuo0wQhZ-m2JRiQTXXBQs7Di8Qb7KK-obp_A2N6CaJ_6cfgW3FM5qLRyO1bKCoo-8Udbj35jhoXUO2g2wf8Tl0bqoVH_h_b5Fw6lRLy4fjQ-umngccJ6dmqT2GzngEKr3WCNnu6JRwNkC2Byq7EEYPbAvUADWX0sZNR6Dmf6CmqPjLU6oOL0DVctgW4j3E1988Ph85jpcnxJRuzaDRtK8rDlD5CVTh522jD9Msw-07q6nd-Y5tgW3DZN4Nt69cmAV1oa3wGaHYnSUw6H60PGgE9igt9x4PwJ4uRUR8d0Zh6xxQeUCgHMNq4NIOxf7r-p-YDjdMiH-DZYbwe67reG8xn0ctTWskt_b0q69wh_3vpX3nZqtQ6HsV_yTIPZqAxmPrJrxT9KfjuDZFqmaqYhWPdJ3kBSsyVrAk6uo8zcuyYorKlnJK85RVIqMsaVmWiLJgkakpJhYnSRYzlrFko1UhBCtYIWSZy0pDGuueG7ux9r1fdj8y3s-6zuM4jSPLhbZ-DR3RoD9wLQLRksGpXnoexHz0kMbW-OC_VIIJdk1rswYSsj0-3ga0N360fEnoYpFyyON1XNcNUhhOo_b40ekBpRva2WuF4oQ9l5NDM-B5v5SWlk88GDdE82TrHzJtQjeLjXQ9ULOwXf4exsm9aRmAmtWRB2pWx98CAAD___bcQdw">