<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/104553>104553</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
cppcoreguidelines-special-member-functions requires default destructors when move and copy are deleted
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
fekir
</td>
</tr>
</table>
<pre>
Consider following class
~~~~
class c
{
public:
int a;
int b;
c( int a1, int b1 )
: a{ a1 }
, b{ b1 }
{
}
c( const c& ) = delete;
c& operator=( const c& ) = delete;
c( c&& ) = delete;
c& operator=( c&& ) = delete;
};
~~~~
clang-tidy, with cppcoreguidelines-special-member-functions and claims that one should also define the destructor
> warning: class 'c' defines a copy constructor and a copy assignment operator but does not define a destructor [cppcoreguidelines-special-member-functions]
I think it might be beneficial to avoid defining `~c() = default`.
Contrary to move and copy operations, destruction is a little bit different.
I am currently not able to think about one use-case where adding a defaulted destructor helps to clarify what this class does.
Would it be possible to not to warn for non-defined destructors when copy and move operators are deleted?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVMGuo7gS_RpnU0pEDIFkweImeZHeF8za2AXUtLEZ29wom3z7yJjc0Lel0fRswLhcdU6dU1h4T51BrNnhzA7XjZhCb13d4g9ym8aqR32xxpNCB63V2t7JdCC18J5lV5Z9pOfz-XymVYqBXL4AgFXn98c4NZokyz_eWwBkAgiWn7_vNV97r9qMH9PpPeOXdGYPjJ_WmTNm_gGCVWcQe2DV9Zcwv0ATw806_BNR-J43Y0trfIjLMqICy6-gUGPAb-znE3ZEJ4J1LL_-Zu5xPvbfUP45MTb1Wr9NS0-phem2gdQj6nOn0IMcR2kddhMp1GTQb_2IkoTeDjg06LbtZGQgazwIo6L3NHgIvQhgDYLv7aQVCO0tKGzJIIQeQaEPbpKR9Aqe5f-Du3CGTBftS3PEeCUZr5ZsDwKkHR9Jy1RiBl620zAPaMKXLNBMAZRFD8aGFwmxogDscP73bbLDdc35_xB6Mj-AAgzU9QEahAYNthSzIVgQn5ZUwo1_DiuzZzT4bU8rJh1Yme1SxYs1wQn3iLmD_cSka2wudTST4JevBsgaoKiLphA0QkMBFLUtOjRh92IpBpCTi1v6MQshGo0RItEXjZ2SY5PHrRQe4d6jQxBKRdbixRPVWrke9ehjFamFo_YB92h86Mkv7kXdd2u9_pjngWadRus9LTQipWBn-6G1Dow12-TVGtBHVmax2qikz8toD8LhMu6K5bc17EbVuTrlJ7HBel_xvDplx32-6WsshZBFWaHA4ljIoyrKLMt4i1WuykxWG6p5xovsuC-zsigP-S7Ly1MuTy3HY1McDpIVGQ6C9E7rz2FnXbch7yes91lxOOQbLRrUfr5cOTd4hznKOI93ratj0raZOs-KTJMP_l0mUNBY_8YP6PCviRz6l1e_CvfzPK3k2kxO130Io483M78xfuso9FOzk3Zg_BZJLa_t6OyfKAPjt7kVz_ht6fWz5n8HAAD__5iS-1o">