<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/143237>143237</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[BUG|clang-tidy] false positive on misc-unconventional-assign-operator
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy,
false-positive
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yaoxinliu
</td>
</tr>
</table>
<pre>
```
struct A {
explicit A(int) {
}
A& operator=(int n) {
// ok, no clang-tidy warning.
return *this = A(n);
}
};
template<typename T>
struct B {
explicit B(int) {
}
B& operator=(int n) {
// clang-tidy warning: Operator=() should always return '*this'
// clang-tidy rule: misc-unconventional-assign-operator
return *this = B(n);
}
};
```
clang-tidy version: 20.1.5
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUk8uOnDoQhp-m2FggU-bSXrCA5vRZZpM8gAEPODE2sk3P9NtH0CTdo0STRELi5vr4v3IhvFejkbKCvIG8jcQaJuuqm7Bvymi1Rp0dbhUU9Dho7YNb-0BqAmUDtCaEEPm2aNWrQGrAkzIBkD-9hbIFWh83NWBB7CKdCNYBa-8FxLwv2cvwAngh9hvgmRhLei3MGAc13MircEaZMXla7WRYnSGAdZiUJ8DaPczGBdaQbeWRo2yBNfdAQc6LFkECO4fbIo2YJfkM7L-HZfM7y-Zjy-ZfFX81A1aTT-8IW7Gf7KoHIvSruPmHcXlIb1cfsbcurVpu7Fn5Pl5Nb81VmqCsETq-T0L8M_iHvW3-0NuneQFaP4W4SueVNVsIpEma5NFQsYEzLiJZpWXGsTxxzqOpwqGQrCxOp5PoCi7z9CU9iV5kQ8_KlKZppCqkmNOClrTIeM6TQRRpPrxgx3nXpxmDjMpZKJ1ofZ0T68ZIeb_KKs0YsjLSopPa74OP-IgIiIBnQHwR2st4sV4FdZXb47yNXLXB4m4dPWRUKx_8Ax9U0Puf1Hz5H8rzEzNvyY4jP3DEmr_ZhWh1uppCWDyw-r6lowrT2iW9nQEv26ePU7w4-1X2AfCya3rAy2F6rfB7AAAA__-LkiYT">