Title
`write_env` implementation-detail lambda should have explicit return type
Status
new
Section
[exec.write.env]
Submitter
Robert A.H. Leahy

Created on 2025-09-29.00:00:00 last changed 2 weeks ago

Messages

Date: 2025-09-29.00:00:00

In [exec.write.env] the impls for `std::execution::write_env` has get-env specified as:

static constexpr auto get-env =
  [](auto, const auto& state, const auto& rcvr) noexcept {
    return see-below;
  };

This uses automatic return type deduction which means that the body of the lambda is actually instantiated in a SFINAE-unfriendly way when attempting to compute various properties of the lambda (invocability, return type, et cetera). This is undesirable and surprising as has been discovered in actual use/deployment (see: https://github.com/NVIDIA/stdexec/pull/1654).

The fix is to explicitly provide a return type for the lambda which computes the type of the body.

Note: This issue may indicate that the use of automatic return type deduction in the specification of sender algorithms more generally ought to be reconsidered/-examined.

History
Date User Action Args
2025-09-29 00:00:00admincreate