Title
std::function needs more noexcept
Status
c++17
Section
[func.wrap.func]
Submitter
Stephan T. Lavavej

Created on 2014-06-14.00:00:00 last changed 89 months ago

Messages

Date: 2014-06-16.23:43:35

Proposed resolution:

This wording is relative to N3936.

  1. Change [function.objects] p2, header <functional> synopsis, as indicated:

    namespace std {
      […]
      // 20.9.11 polymorphic function wrappers:
      […]
      template<class R, class... ArgTypes>
      bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
      template<class R, class... ArgTypes>
      bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
      template<class R, class... ArgTypes>
      bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
      template<class R, class... ArgTypes>
      bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
      […]
    }
    
  2. Change [func.wrap.func], class template function synopsis, as indicated:

    […]
    // 20.9.11.2.1, construct/copy/destroy:
    […]
    function& operator=(nullptr_t) noexcept;
    […]
    
  3. Change [func.wrap.func.con] before p16 as indicated:

    function& operator=(nullptr_t) noexcept;
    
Date: 2014-06-16.00:00:00

[ 2014-06-16 Rapperswil ]

Move to Ready

Date: 2014-06-14.00:00:00

There are two issues here:

  1. std::function's constructor from nullptr_t is marked as noexcept, but its assignment operator from nullptr_t isn't. This assignment can and should be marked as noexcept.

  2. std::function's comparisons with nullptr_t are marked as noexcept in two out of three places.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2014-11-08 19:44:42adminsetstatus: voting -> wp
2014-11-04 10:26:50adminsetstatus: ready -> voting
2014-06-16 23:43:35adminsetmessages: + msg7054
2014-06-16 23:43:35adminsetstatus: new -> ready
2014-06-14 17:51:24adminsetmessages: + msg7033
2014-06-14 00:00:00admincreate