<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/76159>76159</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Inconsistent behavior of cppcoreguidelines-noexcept-move-operations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy,
false-positive,
false-negative
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
carlosgalvezp
</td>
</tr>
</table>
<pre>
Hi,
Consider this example:
https://godbolt.org/z/5zK9abTjz
```cpp
#include <fstream>
struct Data
{
Data() = default;
Data(Data&&) = default;
Data& operator=(Data&&) = default;
Data(Data const&) = delete;
Data& operator=(Data const&) = delete;
~Data() { }
private:
std::ofstream file_{};
};
```
Here, clang-tidy warnings about the operations. However, if I remove the entire private section, then clang-tidy does not warn.
Honestly I don't know what the correct behavior should be. Personally I think all `= default` operations should probably not be warned about.
Anyway, this warning should have a consistent behavior regardless of whether the struct has a private section or not.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVMGO4zYM_Rr5QiRwpDgZH3yYmTSYQS899F7QEm1rV5EMiU42c-i3F7YTxDudFhsIkcTw8T2SETEl23qiShQvojhkOHAXYqUxupBadGf66LM6mGv1ZoV8FflB5M_z92vwyRqKwJ1NQD_w1DsS6vZrx9yn8SaPQh7bYOrgeB1iK-TxQ8hj8fF7ifWf3z6WIcUun5fu-5tFKuu1GwyBUK9N4kh4Euq3JSpxHDTDARlv5v3LfACA2SyfhCxBqAMYanBwLNTLMsTda9520yph8fkK-oi-g9BTRA5RqMO_wvwP7UPfuIEOPvF_kTti-kXunwJ9gX7E-HtZnv0LiP3hJ5c-2jPyo62Q2IwX9RxuzYDGOvprLPn-8CBYnu9Nna9vFEnIV9AOfbtia65wweitbxNgHQYG7uiWkw0-reEtXOhMcQTZBt4h0imcaXIjzzbSXSUk0iNm9OSO_JLDBErgA09k62WOb8FTYneFdzAjds_w3YcLXDqctegQI2mGmjo82xAhdWFwBmpawx8UU_DoJjh31n8HdA7GbBdd3-WLhO7wPoYaa3edVNU0CSMz12ANS4XP_nrB65yVTfdy3eN0eCaYW24Tk18IjdRiNI5SgtDApSPupvdKcHszHSbAz-WDEEdNtyJlplKmVCVmVG32udrsynz7lHVV_mRUo4qi2W_rWhdSNuXmadfonapJl7nKbCVzqTZSbjZblatybcymQYlFXWLZFCoX25xOaN3aufNpnA2ZTWmgar_bFGXmsCaXpsEk5aOTQspxEEnZoEu06kOybM_0yeypxbu5OGSxGilW9dAmsc2dTZwepGzZUfXuv6pgaED3vQ6R2sEactZTWvlAPzT1vBr_h6tFZ7MhuurT5LPcDfVah5OQx5Hytq36GL6RZiGPU9JJyOOU9z8BAAD__1RmuAY">