1291. Exceptions thrown during promise::set_value

Section: 33.6.6 [futures.promise] Status: Resolved Submitter: Jonathan Wakely Opened: 2009-12-18 Last modified: 2016-02-10

Priority: Not Prioritized

View other active issues in [futures.promise].

View all other issues in [futures.promise].

View all issues with Resolved status.

Discussion:

In 33.6.6 [futures.promise]

Does promise<R>::set_value return normally if the copy/move constructor of R throws?

The exception could be caught and set using promise<R>::set_exception, or it could be allowed to leave the set_value call, but it's not clear which is intended. I suggest the exception should not be caught.

N.B. This doesn't apply to promise<R&>::set_value or promise<void>::set_value because they don't construct a new object.

[ 2010 Pittsburgh: Moved to NAD EditorialResolved. Rationale added below. ]

Rationale:

Solved by N3058.

Proposed resolution:

Change 33.6.6 [futures.promise]/18:

18 Throws: future_error if its associated state is already ready or, for the first version an exception thrown by the copy constructor of R, or for the second version an exception thrown by the move constructor of R.