Created on 2024-09-02.00:00:00 last changed yesterday
Proposed resolution:
This wording is relative to N4988.
Modify [unique.ptr.single.observers] as indicated:
constexpr add_lvalue_reference_t<T> operator*() const noexcept(noexcept(*declval<pointer>()));-?- Mandates:
reference_converts_from_temporary_v<add_lvalue_reference_t<T>, decltype(*declval<pointer>())>
is `false`.-1- Preconditions: `get() != nullptr` is `true`.
-2- Returns: `*get()`.
[ 2024-09-18; Reflector poll ]
Set status to Tentatively Ready after seven votes in favour during reflector poll.
If unique_ptr<T,D>::element_type*
and D::pointer
are not the same type, it's possible for `operator*()` to return a dangling
reference that has undefined behaviour.
struct deleter {
using pointer = long*;
void operator()(pointer) const {}
};
long l = 0;
std::unique_ptr<const int, deleter> p(&l);
int i = *p; // undefined
We should make this case ill-formed.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-11-19 16:09:07 | admin | set | status: ready -> voting |
2024-09-18 22:27:46 | admin | set | messages: + msg14381 |
2024-09-18 22:27:46 | admin | set | status: new -> ready |
2024-09-02 12:23:01 | admin | set | messages: + msg14355 |
2024-09-02 00:00:00 | admin | create |