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.

3346. pair and tuple copy and move constructor have backwards specification

Section: 22.3.2 [pairs.pair], 22.4.4.1 [tuple.cnstr] Status: C++20 Submitter: Richard Smith Opened: 2019-11-26 Last modified: 2021-02-25

Priority: 0

View other active issues in [pairs.pair].

View all other issues in [pairs.pair].

View all issues with C++20 status.

Discussion:

22.3.2 [pairs.pair] p2 and 22.4.4.1 [tuple.cnstr] p3 say:

The defaulted move and copy constructor, respectively, of {pair,tuple} is a constexpr function if and only if all required element-wise initializations for copy and move, respectively, would satisfy the requirements for a constexpr function.

Note that we specify the copy constructor in terms of element move operations and the move constructor in terms of element copy operations. Is that really the intent? This appears to be how this was originally specified when the wording was added by N3471.

[2019-12-01; Daniel comments and provides wording]

These inverted wording effects are an unintended oversight caused by N3471.

[2019-12-08 Issue Prioritization]

Status to Tentatively Ready and priority to 0 after ten positive votes on the reflector.

Proposed resolution:

This wording is relative to N4835.

  1. Modify 22.3.2 [pairs.pair] as indicated:

    -2- The defaulted move and copy constructor, respectively, of pair shall be a constexpr function if and only if all required element-wise initializations for copymove and movecopy, respectively, would satisfy the requirements for a constexpr function.

  2. Modify 22.4.4.1 [tuple.cnstr] as indicated:

    -3- The defaulted move and copy constructor, respectively, of tuple shall be a constexpr function if and only if all required element-wise initializations for copymove and movecopy, respectively, would satisfy the requirements for a constexpr function. The defaulted move and copy constructor of tuple<> shall be constexpr functions.