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

4335. task shadows the environment's allocator

Section: 33.13.6.5 [task.promise] Status: New Submitter: Dietmar Kühl Opened: 2025-08-31 Last modified: 2025-09-01

Priority: Not Prioritized

View other active issues in [task.promise].

View all other issues in [task.promise].

View all issues with New status.

Discussion:

Normally, the get_allocator query forwards the allocator from the receiver's environment. For task the get_allocator query used for co_awaited senders uses the allocator passed when creating the coroutine or the default if there was none. It should use the receiver's environment, at least, if the receiver's environment supports a get_allocator query.

Supporting the receiver's allocator isn't always possible: the used allocator type needs to be known when the coroutine is created. At that time the receiver isn't known, yet. As a result the receiver's environment may provide an allocator which is incompatible with the allocator type used by the coroutine. It may be possible to use the receiver's allcoator if it is convertible to the allocator type used by the coroutine and to produce a compile-time error otherwise.

Proposed resolution: