<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/151005>151005</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-tidy cppcoreguidelines-special-member-functions should encourage rule of zero
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
peakschris
</td>
</tr>
</table>
<pre>
The current wording in cppcoreguidelines-special-member-functions description and documentation encourages classes with a default or no-op destructor to be converted into rule of five classes.
Take:
*myclass.hxx*
```
class myclass
{
myclass();
~myclass();
}
```
*myclass.cxx*
```
myclass::~myclass()
{
}
```
clang-tidy on cxx yields:
`Use '= default' to define a trivial destructor (fix available)`
clang-tidy on hxx yields:
`Class 'myclass' defines a destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator`
Neither message encourages the developer to remove the destructor hence creating a rule-of-zero class as per: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-zero
Both messages encourage a new developer to add special functions instead.
Perhaps this requires a custom rule-of-zero check
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVMtuwzYQ_BrqspAhUXYYHXRQEqS3oijSD6DIlcSGIlU-HLuHfntBWbKd1JcCBgwNyR3O7Cy592owiA05vJDDW8ZjGK1rZuSfXoxO-ayz8tx8jAgiOocmwJd1UpkBlAExz8I6HKKSqJVBn_sZheI6n3Dq0OV9NCIoazxI9MKpOX0ANxKkFXFCE_iCoBE2Oj6gB6G59-jhS4UROEjsedQBrANjczunQsFFEayDYKFDENYc0QWUoEyw4KJGsD306ohbsR0pWlK0H_wTSdVePghtp_OyvhtPJ0IX7KlYf0W7LMG6Ja2xF1K0AHDF6DOhNakW-J8HIGFvP2p-pxWPaLc6VUuq9kfV7RIPCwvNzZAHJc9gDYjTCc4KtfSr4KfiD49AKCPV22YqoSx5KLFXBoFDcOqouL63mNDnXp2AH7nSvNOYrvGYcfwv4-tiIaHsKoOtZH7p7JWliwGkRQ_Ghtt1hJ3PqbvbNkJfN_QS25QfsDM6fl2d7BHvz6TcrOijM5uUX1GFER1M6D0f8D6PYUSQeESdDiW7HC7lLviVZ0QjEIRDHtJw8CWHue3zv9HZSw6Be5jRkaqFMYR58Ym-E_quvBXzvBtUGGO3U5bQ99d5frUOf7lO1mOs-l0sBBcVLzaMmwR_0wAcDH59F8GlhHVW4TakyviAXK7j8hu6kc_JAeXB4V9RuaVxIvpgpx8CRxSfmWwqWVc1z7Ap2aFidH-oaTY2VSkP-7IvsS9ZzfayfioYFmUtqBQ1o5iphhb0UDD6XLJ9VdLd_qnsaiE5Ssb6vmJkX-DEld5pfZx21g2Z8j5iUx7Kojhkmneo_fKIUXrLJaE0PWquSafyLg6e7AutfPC3OkEFjc1dlv_Ho-ZHG7W8c3p7fJInWXS6-d7otcPCToS-pxusf_ns7J8owpIFH5dur8qODf03AAD__wHY5Kw">