-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
LWGLibrary Working Group issueLibrary Working Group issue
Description
LWG-4015 LWG-3973 broke const overloads of std::optional monadic operations
It looks like this may be unobservable for us right now, especially because in #4158 I noted that the earlier LWG-3973 was "Implemented without comments". However, I do observe variation between our current implementation and LWG-4015's resolution. For example, our converting move constructor says _STD move(*_Right) (i.e. deref optional, then move):
Lines 292 to 296 in ab6dec6
| template <class _Ty2, enable_if_t<conjunction_v<_AllowUnwrapping<_Ty2>, is_constructible<_Ty, _Ty2>>, int> = 0> | |
| _CONSTEXPR20 explicit(!is_convertible_v<_Ty2, _Ty>) optional(optional<_Ty2>&& _Right) | |
| noexcept(is_nothrow_constructible_v<_Ty, _Ty2>) /* strengthened */ { | |
| if (_Right) { | |
| this->_Construct(_STD move(*_Right)); |
But LWG-4015 specifies std::move(rhs).operator*(), i.e. move optional, then deref.
I'll note this issue in #5607 tracking optional<T&>, but I think we can clean up divergence here before implementing that feature.
Metadata
Metadata
Assignees
Labels
LWGLibrary Working Group issueLibrary Working Group issue
Type
Projects
Status
Available