The following code raises cpp:S3432, “Remove this destructor call.”
static_assert(noexcept(std::declval<T&>().~T()), "T must have a noexcept destructor");
I tend to consider this a false positive since the destructor is never actually “called”.
The following code raises cpp:S3432, “Remove this destructor call.”
static_assert(noexcept(std::declval<T&>().~T()), "T must have a noexcept destructor");
I tend to consider this a false positive since the destructor is never actually “called”.
Hi @bers,
I would not write this code this ways, I would instead use:
static_assert(std::is_nothrow_destructible_v<T>);
However, I agree with you that S3432 should not be raised in a non evaluated context. I created a ticket to exclude these cases from the rule.
Thanks for considering this, and the alternative code! (I did struggle a bit with the construction counterpart of your example because it doesn’t take friendship into account, so it behaves a little different than a direct call. But I found a way to make everything work.)