[meta.rel] is_nothrow_convertible does not clearly require nothrow destruction LWG 3400, LWG 2116 #3576
Labels
lwg
Issue must be reviewed by LWG.
not-editorial
Issue is not deemed editorial; the editorial issue is kept open for tracking.
By @Dani-Hub ,
is_nothrow_convertible
considers destruction of the converted object (ifTo
is an object type) or the temporary (ifTo
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 asThen
std::is_nothrow_convertible_v<int, Weird>
isfalse
.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 ofis_nothrow_convertible
might not be precisely defined, and may lead to unintended comprehension, e.g.std::is_nothrow_convertible_v<int, Weird>
can betrue
since the converting constructor itself is noexcept, although destruction ofWeird
is not.The text was updated successfully, but these errors were encountered: