Created on 2020-04-09.00:00:00 last changed 13 months ago
Proposed resolution:
This wording is relative to N4861.
Modify [memory.syn] as indicated:
[…] template<class T, class D> bool operator>=(nullptr_t, const unique_ptr<T, D>& y); template<class T, class D> requires three_way_comparable_with<typename unique_ptr<T, D>::pointer, nullptr_t> compare_three_way_result_t<typename unique_ptr<T, D>::pointer, nullptr_t> operator<=>(const unique_ptr<T, D>& x, nullptr_t); […]
Modify [unique.ptr.special] as indicated:
template<class T, class D> requires three_way_comparable_with<typename unique_ptr<T, D>::pointer, nullptr_t> compare_three_way_result_t<typename unique_ptr<T, D>::pointer, nullptr_t> operator<=>(const unique_ptr<T, D>& x, nullptr_t);-18- Returns: compare_three_way()(x.get(), static_cast<typename unique_ptr<T, D>::pointer>(nullptr)).
[ 2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP. ]
[ 2020-04-18 Issue Prioritization ]
Status set to Tentatively Ready after seven positive votes on the reflector.
[ 2020-04-14; Replacing the functional cast by a static_cast as result of reflector discussion ]
The constraint for operator<=>(const unique_ptr<T, D>&, nullptr_t) cannot be satisfied, because std::three_way_comparable<nullptr_t> is false, because nullptr <=> nullptr is ill-formed.
We can make it work as intended by comparing x.get() to pointer(nullptr) instead of to nullptr directly.History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2020-11-09 21:40:50 | admin | set | messages: + msg11570 |
2020-11-09 21:40:50 | admin | set | status: ready -> wp |
2020-04-18 12:27:44 | admin | set | messages: + msg11225 |
2020-04-18 12:27:44 | admin | set | status: new -> ready |
2020-04-14 17:15:54 | admin | set | messages: + msg11217 |
2020-04-09 16:30:25 | admin | set | messages: + msg11209 |
2020-04-09 00:00:00 | admin | create |