`exec::finally()` doesn't include error/stopped signatures from final-sender in completion-signatures
lewissbaker opened this issue · 0 comments
lewissbaker commented
The following code-snippet fails to compile because let_error()
computes the variant to hold any potential error produced by finally
, but the completion-signatures listed by finally
do not include the error-types of the final-sender, despite the finally-algorithm forwarding through these errors.
https://godbolt.org/z/av9rhrbPe
#include <stdexec/execution.hpp>
#include <exec/finally.hpp>
#include <cstdio>
struct X {
X() : value(0) { std::puts("X::X()"); }
X(X&& o) noexcept : value(o.value) { std::puts("X::X(X&&)"); }
X(const X& o) noexcept : value(o.value) { std::puts("X::X(const X&)"); }
~X() { std::puts("X::~X()"); value = -1; }
int value;
};
int main() {
auto result = stdexec::sync_wait(
stdexec::let_error(
exec::finally(
stdexec::just(),
stdexec::just_error(X{})),
[](const auto& x) noexcept {
if constexpr (std::same_as<const X&, decltype(x)>) {
std::printf("caught X(value=%i)\n", x.value);
} else {
std::printf("caught an exception_ptr\n");
}
return stdexec::just();
}));
}