<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/153770>153770</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] False positive for misc-unconventional-assign-operator when the type has a forward declaration
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
matthew-f
</td>
</tr>
</table>
<pre>
There looks like a false positive for misc-unconventional-assign-operator when the type has a forward declaration:
```
class MyClass;
class MyClass
{
public:
MyClass() = default;
MyClass& operator=(const MyClass&) = default;
};
```
gives
```
main.cpp:20:2: error: operator=() should return 'MyClass&' [misc-unconventional-assign-operator,-warnings-as-errors]
20 | MyClass& operator=(const MyClass&) = default;
| ^
```
https://godbolt.org/z/f136vPdfj
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0k8GO2yAQhp9mfBk5IhDi-OCDd1PfKvXQF8AwttklxgKcKH36iuxuN416qFTVQkZimO-fGfSrGO04EzUgn0AeC7WmyYfmpFKa6FIORe_Ntfk-USB03r9GdPaVUOGgXCRcfLTJngkHH_Bkoy7XWfv5THOyflaufOOXfqGgkg94mWjGNBGm60I4qZhRPlxUMGhIOxVUzgTRArutPXtfrNVOxYhfr895B_H0duP3U9ZClQPL2jurPzD1R5gfgNcI4oiGBrW69Atzf2mPH_WCOAI_aD_HhJ_hPzOq4yfsrurRniniw-FJ2XmjlwVEy1n-gWiRQsiK7YN6VouTX53BQGkNMwKv7oupEOTTXwwf-HN5UWG28xhLFcubXgR5BNYiImcI1TP-2xTw9mUOyC8PTU8pLTE_Ce-Ad6M3vXdp48MIvPsBvBu2Yn_-ZoaXwjTC1KJWBTXbSkout7WoiqlRB1EPalczUxMTw04rI6UW0vQ0bI3RhW0445IdtpLV8iCrDcn9jg5bRkoPg2YD7BidlHUb586nrF3YGFdqtlJUFSuc6snFmxk4107NY5msuQLn2RyhyVllv44RdszZmOInJ9nkbja6S5NH7P6rT4o1uOZhrjZNa7_R_gS8y9W9b-US_AvpBLy7tRyBd-9dnxv-MwAA___34kXo">