This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

2933. PR for LWG 2773 could be clearer

Section: 22.4.5 [tuple.creation] Status: New Submitter: Eric Fiselier Opened: 2017-02-06 Last modified: 2020-09-06

Priority: 3

View all other issues in [tuple.creation].

View all issues with New status.

Discussion:

The current PR for LWG 2773 changes std::ignore to be a constexpr variable. However it says nothing about whether using std::ignore in std::tie is a constant expression. I think the intent was clearly to allow this. Therefore I suggest we update the resolution to explicitly call this out in a note. (I don't think new normative wording is needed).

I propose we update the current PR as follows:

  1. Keep the current changes proposed by the PR.

  2. Add a note after [tuple.creation]/p7 (std::tie):

    [Note: The constructors and assignment operators provided by ignore shall be constexpr]

Perhaps LWG feels the existing wording is clear enough, but if not I think the above changes sufficiently clarify it.

The ability to constexpr assign to std::ignore can be important: Here is an extremely contrived example:

constexpr bool foo() {
  auto res = std::tie(std::ignore);
  std::get<0>(res) =42; 
  return true;
}
static_assert(foo());

[2017-03-04, Kona]

Set priority to 3. P/R is incorrect; it should NOT be a note. Marshall to work with Eric to get better wording. STL says "use an exposition-only class".

Proposed resolution:

This wording is relative to N4640.

  1. Modify 22.4.5 [tuple.creation] as indicated:

    template<class... TTypes>
      constexpr tuple<TTypes&...> tie(TTypes&... t) noexcept;
    

    -7- Returns: […]

    -?- [Note: The constructors and assignment operators provided by ignore shall be constexpr. — end note]

    -8- [Example: […] — end example]