2523. std::promise synopsis shows two set_value_at_thread_exit()'s for no apparent reason

Section: 32.10.6 [futures.promise] Status: C++17 Submitter: Tim Song Opened: 2015-07-31 Last modified: 2017-07-30

Priority: 0

View other active issues in [futures.promise].

View all other issues in [futures.promise].

View all issues with C++17 status.

Discussion:

In 32.10.6 [futures.promise], the class synopsis shows

void set_value_at_thread_exit(const R& r);
void set_value_at_thread_exit(see below);

There's no apparent reason for having void set_value_at_thread_exit(const R& r);, especially as that signature isn't really present in the specializations (particularly promise<void>). Note that the similar set_value only has a void set_value(see below);

While we are here, 32.10.6 [futures.promise]/p1 says that the specializations "differ only in the argument type of the member function set_value", which missed set_value_at_thread_exit.

[2015-10, Kona issue prioritization]

Priority 0, move to Ready

Proposed resolution:

This wording is relative to N4527.

  1. Edit 32.10.6 [futures.promise], class template promise synopsis, as indicated:

    namespace std {
      template <class R>
      class promise {
      public:
        […]
    
        // setting the result
        void set_value(see below);
        void set_exception(exception_ptr p);
        
        // setting the result with deferred notification
        void set_value_at_thread_exit(const R& r);
        void set_value_at_thread_exit(see below);
        void set_exception_at_thread_exit(exception_ptr p);
      };
    }
    
  2. Edit 32.10.6 [futures.promise]/1 as indicated:

    -1- The implementation shall provide the template promise and two specializations, promise<R&> and promise<void>. These differ only in the argument type of the member functions set_value and set_value_at_thread_exit, as set out in its descriptiontheir descriptions, below.