<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95663>95663</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] bugprone-empty-catch in destructor
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
joto
</td>
</tr>
</table>
<pre>
Destructors are not supposed to throw. Sometimes there is nothing you can do in a destructor but catching a possible exception and ignoring it. The alternative is that the program is terminated and you loose all control over what's happening.
Typical cases include an error message being logged in a destructor or a temp file being removed in a destuctors. In both cases you might already be in a situation where something broke and you are doing your best to report this or clean up. But if that fails, you have no other option but to ignore that failure.
So I believe clang-tidy should make an exception for destructors in the bugprone-empty-catch check.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsk89uszgQwJ8GLqMgYiDZHDh830aRem5fYDADdms8yB6nm7dfGbptVrsXkND8_f0YjNHOnqgvut9Fdy0xieHQv7NwOfD46K8UJSQtHCJgIPAsENO6cqQRhEFM4M8KXnkhsQtFEEOBwMYcaayf4cEJNHoYGawHhPG7IgxJQKPoLQ5h5Rjt4AjoL02rWPaAfgQ7ew45wkoFb4YAnVDwKPa-NRKDktvCGngOuGzfKCzWo9C4lcgzOOaYcx1o9hLYAd8pwKdBKdQ5gsF1JW_9XBX1tah_7c-3x2o1OtAYKYL12qWRAD1QCBxgoRhxJhgoD-h4nmn8z5ocAEFoWWGy7p_YQAvfn4N3yBW8eBhYzFfHPPliZyOALhCODxhoz4lWEm6QPjfkMSvYSA6BP-h772xt5C8TAQaKksUFWjlkbjbmAbUj9JDWCn4nATvtVCe0Lhbqz62QwXv2D5wVA--CskLh3RH9JKVA_8L4yvACAzlLdwLt0M8HseMDouHkRljwY4f6LX7i8IQwk98UD2leA3s60LLK47D9PKAN6Y-qHPtmvDQXLKk_no9_tKfurJrS9MOx7qa2xrpRbYvj0NX6hK0-TthdaDp1pe1Vrdr6dOyOXdOpplLnVk1Yq_rSImqli7amBa2rnLsvFYe5tDEm6i_d6dSUDgdycbsgpX52K5TKFxX6nHQY0hyLtnY2SvwpI1bcdntPad31_7e0_glImYLrjcgai-ZXoW6Fus1WTBoqzUuhbrnD1-uwBn4nLYW6bVPHQt32we-9-jsAAP__HLdl0Q">