Skip to content

Commit f4b9fa1

Browse files
committed
Add workarounds for EDG around promise constructors
1 parent 64d9dad commit f4b9fa1

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

include/exec/at_coroutine_exit.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,15 @@ namespace exec {
132132
public:
133133
using promise_type = __promise;
134134

135+
#if STDEXEC_EDG()
136+
__task(__coro::coroutine_handle<__promise> __coro) noexcept
137+
: __coro_(__coro) {
138+
}
139+
#else
135140
explicit __task(__coro::coroutine_handle<__promise> __coro) noexcept
136141
: __coro_(__coro) {
137142
}
143+
#endif
138144

139145
__task(__task&& __that) noexcept
140146
: __coro_(std::exchange(__that.__coro_, {})) {
@@ -184,10 +190,17 @@ namespace exec {
184190
};
185191

186192
struct __promise : with_awaitable_senders<__promise> {
193+
#if STDEXEC_EDG()
194+
template <class _Action>
195+
__promise(_Action&&, _Ts&&... __ts) noexcept
196+
: __args_{__ts...} {
197+
}
198+
#else
187199
template <class _Action>
188200
explicit __promise(_Action&&, _Ts&... __ts) noexcept
189201
: __args_{__ts...} {
190202
}
203+
#endif
191204

192205
auto initial_suspend() noexcept -> __coro::suspend_always {
193206
return {};

include/exec/on_coro_disposition.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,17 @@ namespace exec {
129129
};
130130

131131
struct __promise : with_awaitable_senders<__promise> {
132+
#if STDEXEC_EDG()
133+
template <class _Action>
134+
__promise(_Action&&, _Ts&&... __ts) noexcept
135+
: __args_{__ts...} {
136+
}
137+
#else
132138
template <class _Action>
133139
explicit __promise(_Action&&, _Ts&... __ts) noexcept
134140
: __args_{__ts...} {
135141
}
142+
#endif
136143

137144
auto initial_suspend() noexcept -> __coro::suspend_always {
138145
return {};
@@ -189,6 +196,12 @@ namespace exec {
189196
private:
190197
template <class _Action, class... _Ts>
191198
static auto __impl(_Action __action, _Ts... __ts) -> __task<_Ts...> {
199+
#if STDEXEC_EDG()
200+
// This works around an EDG bug where the compiler misinterprets __get_disposition:
201+
// operand to this co_await expression resolves to non-class "<unnamed>"
202+
using __get_disposition =
203+
std::enable_if_t<sizeof(_Action) != 0, __on_coro_disp::__get_disposition>;
204+
#endif
192205
task_disposition __d = co_await __get_disposition();
193206
if (__d == _OnCompletion) {
194207
co_await static_cast<_Action&&>(__action)(static_cast<_Ts&&>(__ts)...);

include/stdexec/__detail/__connect_awaitable.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,15 @@ namespace stdexec {
104104
struct __t : __promise_base {
105105
using __id = __promise;
106106

107+
#if STDEXEC_EDG()
108+
__t(auto&&, _Receiver&& __rcvr) noexcept
109+
: __rcvr_(__rcvr) {
110+
}
111+
#else
107112
explicit __t(auto&, _Receiver& __rcvr) noexcept
108113
: __rcvr_(__rcvr) {
109114
}
115+
#endif
110116

111117
auto unhandled_stopped() noexcept -> __coro::coroutine_handle<> {
112118
stdexec::set_stopped(static_cast<_Receiver&&>(__rcvr_));

0 commit comments

Comments
 (0)