Created on 2018-08-09.00:00:00 last changed 49 months ago
Proposed resolution:
This issue is resolved by the resolution of issue 3194.
[ 2020-11-09 Resolved for C++20. Status changed: Tentatively Resolved → Resolved. ]
[ 2018-08-20 Priority set to 3 after reflector discussion ]
Previous resolution [SUPERSEDED]:
[Drafting Note: I've used declval here, despite that "Concepts mean we never have to use declval again!" because the alternative is less readable:]
requires(add_rvalue_reference_t<From> (&f)()) { static_cast<To>(f()); };This wording is relative to N4762.
Modify [concept.convertible] as follows:
template<class From, class To> concept ConvertibleTo = is_convertible_v<From, To> && requires(From (&f)()){ static_cast<To>(f()declval<From>()); };
In the definition of ConvertibleTo in [concept.convertible]:
template<class From, class To> concept ConvertibleTo = is_convertible_v<From, To> && requires(From (&f)()) { static_cast<To>(f()); };
f is an arbitrary function that returns type From. Since functions cannot return array or function types ([dcl.fct] paragraph 11), ConvertibleTo cannot be satisfied when From is an array or function type regardless of the type of To. This is incompatibility with is_convertible_v was not an intentional design feature, so it should be corrected. (Note that any change made here must take care to avoid breaking the ConvertibleTo<T, void> cases.)
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-11-09 22:09:58 | admin | set | messages: + msg11600 |
2020-02-13 20:14:26 | admin | set | status: new -> resolved |
2018-08-20 12:41:52 | admin | set | messages: + msg10080 |
2018-08-09 00:26:25 | admin | set | messages: + msg10059 |
2018-08-09 00:00:00 | admin | create |