Issue 2958: Moves improperly defined as deleted (original) (raw)
This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
2958. Moves improperly defined as deleted
Section: 22.3.2 [pairs.pair], 22.4.4.3 [tuple.assign] Status: C++20 Submitter: Casey Carter Opened: 2017-05-05 Last modified: 2021-02-25
Priority: 2
View other active issues in [pairs.pair].
View all other issues in [pairs.pair].
View all issues with C++20 status.
Discussion:
LWG 2729(i) constrained many pair & tuple assignment operators to "not participate in overload resolution" and "be defined as deleted if." As discussed when LWG reviewed 2756(i), it is undesirable to require that a move constructor or assignment operator be "defined as deleted," since it is unclear whether that operation should be implicitly deleted, and therefore not participate in overload resolution, or explicitly deleted and therefore impede overload resolution for usages that would otherwise find copies.
[2017-07 Toronto Wed Issue Prioritization]
Priority 2
[2017-11 Albuquerque Wednesday issue processing]
Move to Immediate
Proposed resolution:
This wording is relative to N4659.
- Edit 22.3.2 [pairs.pair] as indicated:
pair& operator=(pair&& p) noexcept(see below);
-21- Effects: Assigns to
firstwithstd::forward<first_type>(p.first)and tosecondwithstd::forward<second_type>(p.second).-22- Remarks: This operator shall
be defined as deletednot participate in overload resolutionunlessis_move_assignable_v<first_type>istrueandis_move_assignable_v<second_type>istrue.[…]
- Edit 22.4.4.3 [tuple.assign] as indicated:
tuple& operator=(tuple&& u) noexcept(see below);
-5- Effects: For all
_i_, assignsstd::forward<T_i_>(get<_i_>(u))toget<_i_>(*this).-6- Remarks: This operator shall
be defined as deletednot participate in overload resolution unlessis_move_assignable_v<T_i_>istruefor all_i_.[…]