Skip to content

Commit 687060a

Browse files
committed
try to work around apple-clang name lokup bug
1 parent e343b98 commit 687060a

9 files changed

Lines changed: 42 additions & 68 deletions

include/exec/repeat_until.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,11 @@ namespace experimental::execution
275275
using __eptr_completion_t = set_error_t(std::exception_ptr);
276276
constexpr auto __eptr_completion = (__eptr_completion_t *) nullptr;
277277

278-
STDEXEC_TRY_LET(
279-
auto __sigs,
278+
auto __sigs =
280279
exec::transform_completion_signatures(get_completion_signatures<__child_t, _Env...>(),
281280
__transform_values<__child_t>,
282-
__transform_errors))
281+
__transform_errors);
282+
STDEXEC_IF_OK(__sigs)
283283
{
284284
// The repeat_until sender is a dependent sender if one of the following is
285285
// true:

include/stdexec/__detail/__completion_info.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ namespace STDEXEC
8989
template <auto _GetComplInfo>
9090
constexpr auto __completion_info_from_v = []() noexcept
9191
{
92-
STDEXEC_TRY_LET(auto __cmpl_info, _GetComplInfo())
92+
auto __cmpl_info = _GetComplInfo();
93+
STDEXEC_IF_OK(__cmpl_info)
9394
{
9495
constexpr auto __size = _GetComplInfo().size();
9596
auto __arr = __static_vector<__completion_info, __size>();
@@ -109,7 +110,8 @@ namespace STDEXEC
109110
template <auto _GetComplInfo>
110111
constexpr auto __completion_sigs_from_v = []() noexcept
111112
{
112-
STDEXEC_TRY_LET(constexpr auto __completions, __completion_info_from_v<_GetComplInfo>)
113+
constexpr auto __completions = __completion_info_from_v<_GetComplInfo>;
114+
STDEXEC_IF_OK(__completions)
113115
{
114116
auto __signatures = __static_vector<__type_index, __completions.size()>();
115117
__signatures.resize(__completions.size());
@@ -125,7 +127,8 @@ namespace STDEXEC
125127
template <class _GetComplInfo>
126128
consteval auto __completion_sigs_from(_GetComplInfo) noexcept
127129
{
128-
STDEXEC_TRY_LET(constexpr auto __sigs, __completion_sigs_from_v<(_GetComplInfo())>)
130+
constexpr auto __sigs = __completion_sigs_from_v<(_GetComplInfo())>;
131+
STDEXEC_IF_OK(__sigs)
129132
{
130133
constexpr auto __fn = [=]<std::size_t... _Is>(__indices<_Is...>)
131134
{

include/stdexec/__detail/__completion_signatures.hpp

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -541,50 +541,15 @@ namespace STDEXEC
541541
__cmplsigs::__partitions_of_t<_Sigs>::__count_stopped::value;
542542
} // namespace __detail
543543

544-
// Below is the definition of the STDEXEC_TRY_LET portability macro. It is used to check
544+
// Below is the definition of the STDEXEC_IF_OK portability macro. It is used to check
545545
// that an expression's type is not an __mexception type.
546-
//
547-
// USAGE:
548-
//
549-
// STDEXEC_TRY_LET([constexpr]opt auto c, <expression>)
550-
// {
551-
// // c is guaranteed to not be an instantiation of __mexception.
552-
// }
553-
//
554-
// When constexpr exceptions are available (C++26), the macro simply expands to the
555-
// moral equivalent of:
556-
//
557-
// // With constexpr exceptions:
558-
// auto c = <expression>; // throws if c is an __mexception type
559-
//
560-
// When constexpr exceptions are not available, the macro expands to:
561-
//
562-
// // Without constexpr exceptions:
563-
// if constexpr (auto c = <expression>; __merror<decltype(c)>)
564-
// {
565-
// return c;
566-
// }
567-
// else
568546

569547
#if STDEXEC_NO_STDCPP_CONSTEXPR_EXCEPTIONS()
570548

571-
# define STDEXEC_EAT_AUTO_auto
572-
# define STDEXEC_EAT_CONSTEXPR_constexpr
573-
# define STDEXEC_EAT_CONSTEXPR(_ID) STDEXEC_EAT_CONSTEXPR_ ## _ID
574-
575-
# define STDEXEC_PROBE_CONSTEXPR_constexpr STDEXEC_PP_PROBE(~, 1)
576-
# define STDEXEC_TRY_LET_ID(_ID) \
577-
STDEXEC_PP_CAT( \
578-
STDEXEC_EAT_AUTO_, \
579-
STDEXEC_PP_IIF( \
580-
STDEXEC_PP_CHECK(STDEXEC_PROBE_CONSTEXPR_ ## _ID), \
581-
STDEXEC_EAT_CONSTEXPR, \
582-
STDEXEC_PP_EXPAND)(_ID))
583-
584-
# define STDEXEC_TRY_LET(_ID, ...) \
585-
if constexpr ([[maybe_unused]] _ID = __VA_ARGS__; __merror<decltype(STDEXEC_TRY_LET_ID(_ID))>) \
586-
{ \
587-
return STDEXEC_TRY_LET_ID(_ID); \
549+
# define STDEXEC_IF_OK(_ID) \
550+
if constexpr (STDEXEC::__merror<decltype(_ID)>) \
551+
{ \
552+
return _ID; \
588553
} else
589554

590555
template <class, class _Sndr>
@@ -603,10 +568,7 @@ namespace STDEXEC
603568

604569
#else // ^^^ no constexpr exceptions ^^^ / vvv constexpr exceptions vvv
605570

606-
# define STDEXEC_TRY_LET(_ID, ...) \
607-
if constexpr ([[maybe_unused]] _ID = __VA_ARGS__; false) \
608-
{ \
609-
} else
571+
# define STDEXEC_IF_OK(_ID)
610572

611573
template <class _Result, class _Sndr>
612574
[[noreturn, nodiscard]]

include/stdexec/__detail/__continues_on.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ namespace STDEXEC
318318
template <class _Child, class... _Env>
319319
static consteval auto __get_child_completions()
320320
{
321-
STDEXEC_TRY_LET(auto __child_completions,
322-
STDEXEC::get_completion_signatures<_Child, __fwd_env_t<_Env>...>())
321+
auto __child_completions =
322+
STDEXEC::get_completion_signatures<_Child, __fwd_env_t<_Env>...>();
323+
STDEXEC_IF_OK(__child_completions)
323324
{
324325
// continues_on has the completions of the child sender, but with value and
325326
// error result types decayed.
@@ -334,8 +335,9 @@ namespace STDEXEC
334335
static consteval auto __get_scheduler_completions()
335336
{
336337
using __sndr_t = schedule_result_t<_Scheduler>;
337-
STDEXEC_TRY_LET(auto __sched_completions,
338-
STDEXEC::get_completion_signatures<__sndr_t, __fwd_env_t<_Env>...>())
338+
auto __sched_completions =
339+
STDEXEC::get_completion_signatures<__sndr_t, __fwd_env_t<_Env>...>();
340+
STDEXEC_IF_OK(__sched_completions)
339341
{
340342
// The scheduler contributes only error and stopped completions; we ignore value
341343
// completions here

include/stdexec/__detail/__finally.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,13 @@ namespace STDEXEC
307307
template <class _CvInitialSender, class _CvFinalSender, class... _Env>
308308
consteval auto __get_completion_signatures()
309309
{
310-
STDEXEC_TRY_LET(auto __initial_completions,
311-
get_completion_signatures<_CvInitialSender, _Env...>())
310+
auto __initial_completions = get_completion_signatures<_CvInitialSender, _Env...>();
311+
STDEXEC_IF_OK(__initial_completions)
312312
{
313313
using __initial_completions_t = decltype(__initial_completions);
314-
STDEXEC_TRY_LET(
315-
auto __final_completions,
316-
get_completion_signatures<_CvFinalSender, __mk_final_env_t<_CvInitialSender, _Env>...>())
314+
auto __final_completions =
315+
get_completion_signatures<_CvFinalSender, __mk_final_env_t<_CvInitialSender, _Env>...>();
316+
STDEXEC_IF_OK(__final_completions)
317317
{
318318
if constexpr (__never_sends<set_value_t,
319319
_CvFinalSender,

include/stdexec/__detail/__get_completion_signatures.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ namespace STDEXEC
388388
template <class _Sender, class... _Env>
389389
consteval auto __get_completion_info()
390390
{
391-
STDEXEC_TRY_LET(auto __cmplsigs, STDEXEC::get_completion_signatures<_Sender, _Env...>())
391+
auto __cmplsigs = STDEXEC::get_completion_signatures<_Sender, _Env...>();
392+
STDEXEC_IF_OK(__cmplsigs)
392393
{
393394
auto __cmplinfo = STDEXEC::__cmplsigs::__to_array(__cmplsigs);
394395
std::ranges::for_each(__cmplinfo, &__completion_info::__populate<_Sender, _Env...>);

include/stdexec/__detail/__let.hpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,9 @@ namespace STDEXEC
567567
else
568568
{
569569
using __sndr2_t = __invoke_result_t<_Fun, __decay_t<_As>&...>;
570-
STDEXEC_TRY_LET(constexpr auto __cmpls,
571-
STDEXEC::__get_completion_info<__sndr2_t, __env2_t<_Child, _Env>...>())
570+
constexpr auto __cmpls =
571+
STDEXEC::__get_completion_info<__sndr2_t, __env2_t<_Child, _Env>...>();
572+
STDEXEC_IF_OK(__cmpls)
572573
{
573574
if constexpr (!__nothrow_decay_copyable<_As...>
574575
|| !__nothrow_invocable<_Fun, __decay_t<_As>&...>
@@ -616,13 +617,15 @@ namespace STDEXEC
616617
constexpr auto __transform = __transform_cmplsig<_Fun, _Child, _Env...>;
617618
constexpr auto __get_sig = &__completion_info::__signature;
618619
constexpr auto __eptr_sig_id = __mtypeid<__eptr_sig_t>;
620+
constexpr auto __cmpls = STDEXEC::__get_completion_info<_Child, _Env...>();
619621

620-
STDEXEC_TRY_LET(constexpr auto __cmpls, STDEXEC::__get_completion_info<_Child, _Env...>())
622+
STDEXEC_IF_OK(__cmpls)
621623
{
622624
constexpr auto __idx = __make_indices<__cmpls.size()>();
623625
constexpr auto __get_cmpls2 = __get_cmpl_info_i<__cmpls, __transform>(__idx);
626+
constexpr auto __cmpls2 = __cmplsigs::__completion_info_from(__get_cmpls2);
624627

625-
STDEXEC_TRY_LET(constexpr auto __cmpls2, __cmplsigs::__completion_info_from(__get_cmpls2))
628+
STDEXEC_IF_OK(__cmpls2)
626629
{
627630
if constexpr (std::ranges::find(__cmpls2, __eptr_sig_id, __get_sig) == __cmpls2.end()
628631
&& sizeof...(_Env) == 0)

include/stdexec/__detail/__stopped_as_optional.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ namespace STDEXEC
6666
static constexpr auto __get_completion_signatures()
6767
{
6868
static_assert(__sender_for<_Self, stopped_as_optional_t>);
69-
STDEXEC_TRY_LET(auto __completions,
70-
STDEXEC::get_completion_signatures<__child_of<_Self>, _Env...>())
69+
auto __completions = STDEXEC::get_completion_signatures<__child_of<_Self>, _Env...>();
70+
71+
STDEXEC_IF_OK(__completions)
7172
{
7273
using _Completions = decltype(__completions);
7374
if constexpr (__single_value_sender<__child_of<_Self>, _Env...>)

include/stdexec/__detail/__transform_completion_signatures.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,9 +575,11 @@ namespace STDEXEC
575575
_StoppedFn __stopped_fn = {},
576576
_ExtraSigs = {})
577577
{
578-
STDEXEC_TRY_LET(auto __completions, _Completions{})
578+
auto __completions = _Completions{};
579+
STDEXEC_IF_OK(__completions)
579580
{
580-
STDEXEC_TRY_LET(auto __extra_sigs, _ExtraSigs{})
581+
auto __extra_sigs = _ExtraSigs{};
582+
STDEXEC_IF_OK(__extra_sigs)
581583
{
582584
__cmplsigs::__transform_one __tfx1{__value_fn, __error_fn, __stopped_fn};
583585
return __concat_completion_signatures(__completions.__apply(

0 commit comments

Comments
 (0)