2762. unique_ptr operator*() should be noexcept

Section: 23.11.1.2.4 [unique.ptr.single.observers] Status: LEWG Submitter: Ville Voutilainen Opened: 2016-08-04 Last modified: 2016-11-26

Priority: 3

View all other issues in [unique.ptr.single.observers].

View all issues with LEWG 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.

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.]

  1. In 23.11.1.2 [unique.ptr.single] synopsis, edit as follows:

    add_lvalue_reference_t<T> operator*() const noexcept;
    
  2. Before 23.11.1.2.4 [unique.ptr.single.observers]/1, edit as follows:

    add_lvalue_reference_t<T> operator*() const noexcept;
    
  3. In 23.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;
    
  4. Before [optional.object.observe]/1, edit as follows:

    constexpr T const* operator->() const noexcept;
    constexpr T* operator->() noexcept;
    
  5. Before [optional.object.observe]/5, edit as follows:

    constexpr T const& operator*() const & noexcept;
    constexpr T& operator*() & noexcept;
    
  6. Before [optional.object.observe]/9, edit as follows:

    constexpr T&& operator*() && noexcept;
    constexpr const T&& operator*() const && noexcept;