Title
[fund.ts.v2] LWG 2451 conversion constructor constraint
Status
open
Section
[optional.object.ctor]
Submitter
Casey Carter

Created on 2016-07-20.00:00:00 last changed 81 months ago

Messages

Date: 2016-08-01.18:34:48

Proposed resolution:

This wording is relative to N4600.

Wording relative to N4600 + LWG 2451, although it should be noted that this resolution should be applied wherever LWG 2451 is applied, be that to the fundamentals TS or the specification of optional in the C++ Working Paper.

  1. In [optional.object.ctor], modify as indicated:

    template <class U>
      constexpr optional(U&& v);
    

    […]

    -43- Remarks: If T's selected constructor is a constexpr constructor, this constructor shall be a constexpr constructor. This constructor shall not participate in overload resolution unless is_constructible_v<T, U&&> is true and decay_t<U> is not the same type as T. The constructor is explicit if and only if is_convertible_v<U&&, T> is false.

Date: 2016-08-01.18:34:48

[ 2016-07 Chicago ]

Monday: P0 - tentatively ready

Date: 2016-07-20.00:00:00

Addresses: fund.ts.v2

LWG 2451 adds a converting constructor to optional with signature:

template <class U>
constexpr optional(U&& v);

and specifies that "This constructor shall not participate in overload resolution unless is_constructible_v<T, U&&> is true and U is not the same type as T." This suffices to avoid this constructor being selected by overload resolution for arguments that should match the move constructor, but not for arguments that should match the copy constructor. The recent churn around tuple's constructors suggests that we want this constructor to not participate in overload resolution if remove_cv_t<remove_reference_t<U>> is the same type as T.

History
Date User Action Args
2017-07-30 20:10:41adminsetstatus: wp -> open
2016-11-14 03:59:28adminsetstatus: pending -> wp
2016-11-14 03:55:22adminsetstatus: ready -> pending
2016-08-01 18:34:48adminsetmessages: + msg8288
2016-08-01 18:34:48adminsetstatus: new -> ready
2016-07-26 19:23:12adminsetmessages: + msg8257
2016-07-20 00:00:00admincreate