This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Open status.
Section: 19.11.1.2.4 [unique.ptr.single.observers] Status: Open Submitter: Ville Voutilainen Opened: 2016-08-04 Last modified: 2018-06-23
Priority: 3
View all other issues in [unique.ptr.single.observers].
View all issues with Open status.
Discussion:
See LWG 2337. Since we aren't removing noexcept from shared_ptr's operator*, we should consider adding noexcept to unique_ptr's operator*.
[2016-08 — Chicago]
Thurs PM: P3, and status to 'LEWG'
[2016-08-05 Chicago]
Ville provides an initial proposed wording.
[LEWG Kona 2017]
->Open: Believe these should be noexcept for consistency. We like these. We agree with the proposed resolution. operator->() already has noexcept.
Also adds optional::operator*
Alisdair points out that fancy pointers might intentionally throw from operator*, and we don't want to prohibit that.
Go forward with conditional noexcept(noexcept(*decltype())).
Proposed resolution:
This wording is relative to N4606.
[Drafting note: since this issue is all about consistency, optional's pointer-like operators are additionally included.]
In 19.11.1.2 [unique.ptr.single] synopsis, edit as follows:
add_lvalue_reference_t<T> operator*() const noexcept;
Before 19.11.1.2.4 [unique.ptr.single.observers]/1, edit as follows:
add_lvalue_reference_t<T> operator*() const noexcept;
In 19.6.3 [optional.optional] synopsis, edit as follows:
constexpr T const *operator->() const noexcept; constexpr T *operator->() noexcept; constexpr T const &operator*() const & noexcept; constexpr T &operator*() & noexcept; constexpr T &&operator*() && noexcept; constexpr const T &&operator*() const && noexcept;
Before [optional.object.observe]/1, edit as follows:
constexpr T const* operator->() const noexcept; constexpr T* operator->() noexcept;
Before [optional.object.observe]/5, edit as follows:
constexpr T const& operator*() const & noexcept; constexpr T& operator*() & noexcept;
Before [optional.object.observe]/9, edit as follows:
constexpr T&& operator*() && noexcept; constexpr const T&& operator*() const && noexcept;