This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.

2120. What should async do if neither 'async' nor 'deferred' is set in policy?

Section: 32.10.9 [futures.async] Status: C++14 Submitter: Jonathan Wakely Opened: 2012-01-01 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [futures.async].

View all other issues in [futures.async].

View all issues with C++14 status.

Discussion:

Implementations already disagree, one returns an invalid future with no shared state, one chooses policy == async and one chooses policy == deferred, see c++std-lib-30839, c++std-lib-30840 and c++std-lib-30844. It's not clear if returning an invalid future is allowed by the current wording.

If the intention is to allow an empty future to be returned, then 32.10.9 [futures.async] p3 and p4 should be adjusted to clarify that a shared state might not be created and an invalid future might be returned.

If the intention is that a valid future is always returned, p3 should say something about the case where none of the conditions applies.

[2012, Portland: move to Review]

We could make it undefined if no launch policy is defined.

Hans: If no launch policy is specified the behaviour is undefined

Artur: or implementation defined?

Hans: no: we don't want people to do this

[Proposed wording]

This wording is relative to N3376

Add a third bullet to the end of the list in 30.6.8p3

"if no valid launch policy is provided the behaviour is undefined"

Moved to review

[2013-04-19, Bristol]

Detlef provides new wording

Previous wording:

[This wording is relative to N3376]

Add a third bullet to the end of the list in 32.10.9 [futures.async]p3

– if no valid launch policy is provided the behaviour is undefined

[2013-09 Chicago]

If no policy is given, it should be undefined, so moved to Immediate.

Accept for Working Paper

Proposed resolution:

[This wording is relative to N3485]

Add a third bullet to the end of the list in 32.10.9 [futures.async]p3

– If no value is set in the launch policy, or a value is set that is neither specified in this International Standard or by the implementation, the behaviour is undefined.