[meta.rel] is_nothrow_convertible does not clearly require nothrow destruction LWG 3400, LWG 2116 (original) (raw)
By @Dani-Hub , is_nothrow_convertible considers destruction of the converted object (if To is an object type) or the temporary (if To is a reference type and the temporary to bind would be created) by design. And known implementations (msvc, libc++, libstdc++) behave correctly.
For example, given a type Weird defined as
struct Weird {
Weird(int) noexcept {}
~Weird() noexcept(false) {}
};
Then std::is_nothrow_convertible_v<int, Weird> is false.
However, I suspect that wording in [meta.rel]/5 only requires the well-formedness, and whether the destruction after the initialization of To is considered as part of the conversion is not mentioned.
So "the conversion, as defined by is_convertible" in the specification of is_nothrow_convertible might not be precisely defined, and may lead to unintended comprehension, e.g. std::is_nothrow_convertible_v<int, Weird> can be true since the converting constructor itself is noexcept, although destruction of Weird is not.