Created on 2022-06-23.00:00:00 last changed 13 months ago
Proposed resolution:
This wording is relative to N4910.
Modify [expos.only.func] as indicated:
-2- The following are defined for exposition only to aid in the specification of the library:
namespace std { template<class T> requires convertible_to<T, decay_t<T>> constexpr decay_t<T> decay-copy(T&& v) noexcept(is_nothrow_convertible_v<T, decay_t<T>>) // exposition only { return std::forward<T>(v); } […] }
[ 2022-07-25 Approved at July 2022 virtual plenary. Status changed: Ready → WP. ]
[ 2022-07-15; LWG telecon: move to Ready ]
[ 2022-07-11; Reflector poll ]
Set status to Tentatively Ready after seven votes in favour during reflector poll.
[ 2022-07-08; Reflector poll ]
Set priority to 3 after reflector poll.
The spec of views::all [range.all.general] p2 says:
Given a subexpression E, the expression views::all(E) is expression-equivalent to:
(2.1) — decay-copy(E) if the decayed type of E models view.
[…]
If E is an lvalue move-only view, according to the spec, views::all(E) would be expression-equivalent to decay-copy(E).
However, [expos.only.func] p2 defines decay-copy as followstemplate<class T> constexpr decay_t<T> decay-copy(T&& v) noexcept(is_nothrow_convertible_v<T, decay_t<T>>) // exposition only { return std::forward<T>(v); }
It is unconstrained. As a result, for the above example, views::all(E) is a well-formed expression and it would only error on the template instantiation of the function body of decay-copy, because E is an lvalue of move-only type and not copyable.
I think this behaviour is wrong, instead, we should make decay-copy(E) ill-formed if it is not copyable, so that views::all(E) can be SFINAE friendly.History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2022-07-25 20:32:58 | admin | set | messages: + msg12658 |
2022-07-25 20:32:58 | admin | set | status: ready -> wp |
2022-07-25 20:28:19 | admin | set | messages: + msg12632 |
2022-07-11 10:09:12 | admin | set | messages: + msg12579 |
2022-07-11 10:09:12 | admin | set | status: new -> ready |
2022-07-08 20:04:38 | admin | set | messages: + msg12564 |
2022-06-26 08:58:47 | admin | set | messages: + msg12537 |
2022-06-23 00:00:00 | admin | create |