Title
Minor Inconsistency between promise::set_value and promise::set_value_at_thread_exit
Status
c++14
Section
[futures.promise]
Submitter
Pete Becker

Created on 2011-11-14.00:00:00 last changed 131 months ago

Messages

Date: 2013-04-20.08:17:49

Proposed resolution:

This wording is relative to the FDIS.

  1. Change [futures.promise]/16 as indicated:

    void promise::set_value(const R& r);
    void promise::set_value(R&& r);
    void promise<R&>::set_value(R& r);
    void promise<void>::set_value();
    

    […]

    -16- Throws:

    • future_error if its shared state already has a stored value or exception, or
    • for the first version, any exception thrown by the copy constructor ofconstructor selected to copy an object of R, or
    • for the second version, any exception thrown by the move constructor ofconstructor selected to move an object of R.
  2. Change [futures.promise]/22 as indicated:

    void promise::set_value_at_thread_exit(const R& r);
    void promise::set_value_at_thread_exit(R&& r);
    void promise<R&>::set_value_at_thread_exit(R& r);
    void promise<void>::set_value_at_thread_exit();
    

    […]

    -16- Throws: future_error if an error condition occurs.

    • future_error if its shared state already has a stored value or exception, or
    • for the first version, any exception thrown by the constructor selected to copy an object of R, or
    • for the second version, any exception thrown by the constructor selected to move an object of R.
Date: 2013-04-15.00:00:00

[ 2013-04-20, Bristol ]

Accepted for the working paper

Date: 2012-11-02.22:48:46

[ 2012, Portland: move to Review ]

Moved to Review by the concurrency working group, with no further comments.

Date: 2011-11-14.00:00:00

[futures.promise]/16 says that promise::set_value(const R&) throws any exceptions thrown by R's copy constructor, and that promise_set_value(R&&) throws any exceptions thrown by R's move constructor.

[futures.promise]/22 is the Throws: clause for promise::set_value_at_thread_exit. It has no corresponding requirements, only that these functions throw "future_error if an error condition occurs."

Daniel suggests wording to fix this: The approach is a bit more ambitious and also attempts to fix wording glitches of [futures.promise]/16, because it would be beyond acceptable efforts of implementations to determine whether a constructor call of a user-defined type will indeed call a copy constructor or move constructor (in the first case it might be a template constructor, in the second case it might also be a copy-constructor, if the type has no move constructor).

History
Date User Action Args
2014-02-20 13:20:35adminsetstatus: wp -> c++14
2013-04-25 19:07:07adminsetstatus: voting -> wp
2013-04-20 08:17:49adminsetmessages: + msg6492
2013-04-20 08:17:49adminsetstatus: review -> voting
2012-11-02 22:48:46adminsetmessages: + msg6238
2012-11-02 22:48:46adminsetstatus: new -> review
2011-11-28 20:03:03adminsetmessages: + msg5927
2011-11-14 00:00:00admincreate