in_place_t
check for optional::optional(U&&)
should decay U
Section: 22.5.3.2 [optional.ctor] Status: C++17 Submitter: Tim Song Opened: 2016-12-13 Last modified: 2020-09-06
Priority: 0
View all other issues in [optional.ctor].
View all issues with C++17 status.
Discussion:
As in_place_t
is a normal tag type again, we need to decay U
before doing the is_same_v
check.
[2017-01-27 Telecon]
Priority 0
Proposed resolution:
This wording is relative to N4618.
Edit 22.5.3.2 [optional.ctor] as indicated:
template <class U = T> EXPLICIT constexpr optional(U&& v);[…]
-22- Remarks: IfT
's selected constructor is aconstexpr
constructor, this constructor shall be aconstexpr
constructor. This constructor shall not participate in overload resolution unlessis_constructible_v<T, U&&>
istrue
,is_same_v<decay_t<U>, in_place_t>
isfalse
, andis_same_v<optional<T>, decay_t<U>>
isfalse
. The constructor is explicit if and only ifis_convertible_v<U&&, T>
isfalse
.