Created on 2023-01-29.00:00:00 last changed 12 months ago
Proposed resolution:
This wording is relative to N4928.
Modify [expected.object.monadic] as indicated:
template<class F> constexpr auto transform_error(F&& f) &; template<class F> constexpr auto transform_error(F&& f) const &;[…][…]
-27- Mandates: G is a validvalue type for expectedtemplate argument for unexpected ([expected.un.general]) and the declarationG g(invoke(std::forward<F>(f), error()));is well-formed.
[…]template<class F> constexpr auto transform_error(F&& f) &&; template<class F> constexpr auto transform_error(F&& f) const &&;[…]
-31- Mandates: G is a validvalue type for expectedtemplate argument for unexpected ([expected.un.general]) and the declarationG g(invoke(std::forward<F>(f), std::move(error())));is well-formed.
[…]
Modify [expected.void.monadic] as indicated:
template<class F> constexpr auto transform_error(F&& f) &; template<class F> constexpr auto transform_error(F&& f) const &;[…][…]
-24- Mandates: G is a validvalue type for expectedtemplate argument for unexpected ([expected.un.general]) and the declarationG g(invoke(std::forward<F>(f), error()));is well-formed.
[…]template<class F> constexpr auto transform_error(F&& f) &&; template<class F> constexpr auto transform_error(F&& f) const &&;[…]
-27- Mandates: G is a validvalue type for expectedtemplate argument for unexpected ([expected.un.general]) and the declarationG g(invoke(std::forward<F>(f), std::move(error())));is well-formed.
[…]
[ 2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Voting → WP. ]
[ 2023-02-06; Reflector poll ]
Set status to Tentatively Ready after five votes in favour during reflector poll.
The overloads of expected::transform_error mandate that "[type] G is a valid value type for expected" ([expected.object.monadic]/27 and 31 as well as [expected.void.monadic]/24 and 27)).
All of these overloads then instantiate expected<T, G> (for some type T) which doesn't require G to be a valid value type for expected ([expected.object.general]/2) but instead requires that G is "a valid template argument for unexpected" ([expected.object.general]/2). Comparing [expected.object.general]/2 with [expected.un.general]/2 it's clear that there are types — const int, for example — which are valid value types for expected but not valid template arguments for unexpected. Presumably this unimplementable requirement is a typo, and the subject paragraphs intended to require that G be a valid template argument for unexpected.History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2023-02-13 10:17:57 | admin | set | messages: + msg13375 |
2023-02-13 10:17:57 | admin | set | status: voting -> wp |
2023-02-06 15:33:48 | admin | set | status: ready -> voting |
2023-02-06 15:13:50 | admin | set | messages: + msg13267 |
2023-02-06 15:13:50 | admin | set | status: new -> ready |
2023-01-29 12:06:09 | admin | set | messages: + msg13231 |
2023-01-29 00:00:00 | admin | create |