This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of LEWG status.
variant
copy constructor missing noexcept(see below)
Section: 22.6.3.2 [variant.ctor] Status: LEWG Submitter: Peter Dimov Opened: 2017-06-27 Last modified: 2017-07-12
Priority: Not Prioritized
View other active issues in [variant.ctor].
View all other issues in [variant.ctor].
View all issues with LEWG status.
Discussion:
The copy constructor of std::variant
is not conditionally noexcept
(I think
it was in the original proposal.)
constexpr variant() noexcept(see below); variant(variant&&) noexcept(see below); template <class T> constexpr variant(T&&) noexcept(see below);
and second, variant
itself makes use of is_nothrow_copy_constructible
, so
it's inconsistent for it to take a stance against it.
[2017-07 Toronto Tuesday PM issue prioritization]
Status to LEWG
Proposed resolution:
This wording is relative to N4659.
Edit 22.6.3 [variant.variant], class template variant
synopsis, as indicated:
template <class... Types> class variant { public: // 23.7.3.1, constructors constexpr variant() noexcept(see below); variant(const variant&) noexcept(see below); variant(variant&&) noexcept(see below); […] };
Edit 22.6.3.2 [variant.ctor] as indicated:
variant(const variant& w) noexcept(see below);[…]
-8- Remarks: This function shall not participate in overload resolution unlessis_copy_constructible_v<Ti>
istrue
for alli
. The expression insidenoexcept
is equivalent to the logical AND ofis_nothrow_copy_constructible_v<Ti>
for alli
.