Skip to content

Commit b4692ce

Browse files
burblebeetkoeppe
authored andcommitted
LWG4198 schedule_from isn't starting the schedule sender if decay-copying results throws
1 parent 06614c2 commit b4692ce

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

source/exec.tex

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,11 +3026,19 @@
30263026
Let \tcode{Sigs} be
30273027
a pack of the arguments to the \tcode{completion_signatures} specialization
30283028
named by \tcode{completion_signatures_of_t<\exposid{child-type}<Sndr>, env_of_t<Rcvr>>}.
3029-
Let \exposid{as-tuple} be an alias template
3030-
that transforms a completion signature \tcode{Tag(Args...)} into
3031-
the tuple specialization \tcode{\exposid{decayed-tuple}<Tag, Args...>}.
3029+
Let \exposid{as-tuple} be an alias template such that
3030+
\tcode{\exposid{as-tuple}<Tag(Args...)>} denotes
3031+
the type \tcode{\exposid{decayed-tuple}<Tag, Args...>}, and
3032+
let \exposid{is-no\-throw-decay-copy-sig} be a variable template such that
3033+
\tcode{auto(\exposid{is-nothrow-decay-copy-sig}<Tag(Args...\linebreak{})>)} is
3034+
a constant expression of type \tcode{bool} and
3035+
equal to \tcode{(is_nothrow_constructible_v<decay_t<Args>, Args> \&\& ...)}.
3036+
Let \exposid{error-completion} be a pack consisting of
3037+
the type \tcode{set_error_t(exception_ptr)}
3038+
if \tcode{(\exposid{is-nothrow-decay-copy-sig}<Sigs> \&\&...)} is \tcode{false},
3039+
and an empty pack otherwise.
30323040
Then \tcode{variant_t} denotes
3033-
the type \tcode{variant<monostate, \exposid{as-tuple}<Sigs>...>},
3041+
the type \tcode{variant<monostate, \exposid{as-tuple}<Sigs>..., \exposid{error-completion}...>},
30343042
except with duplicate types removed.
30353043

30363044
\pnum
@@ -3081,15 +3089,14 @@
30813089
[]<class Tag, class... Args>(auto, auto& state, auto& rcvr, Tag, Args&&... args) noexcept
30823090
-> void {
30833091
using result_t = @\exposid{decayed-tuple}@<Tag, Args...>;
3084-
constexpr bool nothrow = is_nothrow_constructible_v<result_t, Tag, Args...>;
3092+
constexpr bool nothrow = (is_nothrow_constructible_v<decay_t<Args>, Args> && ...);
30853093

30863094
try {
30873095
state.@\exposid{async-result}@.template emplace<result_t>(Tag(), std::forward<Args>(args)...);
30883096
} catch (...) {
3089-
if constexpr (!nothrow) {
3090-
set_error(std::move(rcvr), current_exception());
3091-
return;
3092-
}
3097+
if constexpr (!nothrow)
3098+
state.@\exposid{async-result}@.template emplace<tuple<set_error_t,
3099+
exception_ptr>>(set_error, current_exception());
30933100
}
30943101
start(state.@\exposid{op-state}@);
30953102
};

0 commit comments

Comments
 (0)