Skip to content

Commit 4a2dfa4

Browse files
committed
fixes for get_completion_signatures with constexpr exceptions
1 parent 56613d3 commit 4a2dfa4

15 files changed

+315
-345
lines changed

include/exec/any_sender_of.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace experimental::execution
8181

8282
template <class QueryFn, class... Env>
8383
inline constexpr auto _check_query_v = std::conditional_t<sizeof...(Env) == 0,
84-
_ERROR_<dependent_sender_error>,
84+
__mexception<dependent_sender_error>,
8585
_no_query_error_t<QueryFn, Env...>>{};
8686

8787
template <class Result, class Query, class... Args, class... Env>
@@ -477,7 +477,7 @@ namespace experimental::execution
477477
using _base_t::_base_t;
478478

479479
template <__std::derived_from<_interface_> Self, class... Env>
480-
static consteval auto get_completion_signatures() noexcept
480+
static consteval auto get_completion_signatures()
481481
{
482482
// throw if Env does not contain the queries needed to type-erase the receiver:
483483
using _check_queries_t = __mfind_error<_check_query_t<Queries, Env...>...>;

include/exec/detail/system_context_replaceability_api.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222

2323
#include <memory>
2424

25+
STDEXEC_PRAGMA_PUSH()
26+
STDEXEC_PRAGMA_IGNORE_GNU("-Wdeprecated-declarations")
27+
STDEXEC_PRAGMA_IGNORE_MSVC(4996) // warning C4996: 'function': was declared deprecated
28+
STDEXEC_PRAGMA_IGNORE_EDG(deprecated_entity)
29+
STDEXEC_PRAGMA_IGNORE_EDG(deprecated_entity_with_custom_message)
30+
2531
namespace experimental::execution
2632
{
2733
namespace [[deprecated("Use the " STDEXEC_PP_STRINGIZE(STDEXEC) //
@@ -47,11 +53,6 @@ namespace experimental::execution
4753
return STDEXEC::parallel_scheduler_replacement::query_parallel_scheduler_backend();
4854
}
4955

50-
STDEXEC_PRAGMA_PUSH()
51-
STDEXEC_PRAGMA_IGNORE_GNU("-Wdeprecated-declarations")
52-
STDEXEC_PRAGMA_IGNORE_MSVC(4996) // warning C4996: 'function': was declared deprecated
53-
STDEXEC_PRAGMA_IGNORE_EDG(deprecated_entity)
54-
STDEXEC_PRAGMA_IGNORE_EDG(deprecated_entity_with_custom_message)
5556
/// Set a factory for the parallel scheduler backend.
5657
/// Can be used to replace the parallel scheduler at runtime.
5758
/// Out of spec.
@@ -63,7 +64,6 @@ namespace experimental::execution
6364
{
6465
return STDEXEC::parallel_scheduler_replacement::set_parallel_scheduler_backend(__new_factory);
6566
}
66-
STDEXEC_PRAGMA_POP()
6767

6868
/// Interface for completing a sender operation. Backend will call frontend though this interface
6969
/// for completing the `schedule` and `schedule_bulk` operations.
@@ -79,6 +79,8 @@ namespace experimental::execution
7979
} // namespace system_context_replaceability
8080
} // namespace experimental::execution
8181

82+
STDEXEC_PRAGMA_POP()
83+
8284
namespace exec = experimental::execution;
8385

8486
#endif

include/exec/sequence/any_sequence_of.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#include "../any_sender_of.hpp"
2222
#include "../sequence_senders.hpp"
2323

24+
STDEXEC_PRAGMA_PUSH()
25+
STDEXEC_PRAGMA_IGNORE_GNU("-Woverloaded-virtual")
26+
2427
namespace experimental::execution
2528
{
2629
template <class _Sigs, class _Queries = queries<>>
@@ -225,4 +228,6 @@ namespace experimental::execution
225228
};
226229
} // namespace experimental::execution
227230

231+
STDEXEC_PRAGMA_POP()
232+
228233
namespace exec = experimental::execution;

include/exec/sequence/merge.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ namespace experimental::execution
174174
}
175175

176176
template <class _Self, class... _Env>
177-
static consteval auto get_completion_signatures() noexcept
177+
static consteval auto get_completion_signatures()
178178
{
179179
static_assert(sender_for<_Self, merge_t>);
180180
auto __items = STDEXEC::__children_of<_Self, STDEXEC::__qq<item_types>>();

include/exec/sequence/transform_each.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ namespace experimental::execution
125125

126126
template <class _Adaptor, class _Sequence>
127127
auto operator()(__ignore, _Adaptor __adaptor, _Sequence&& __sequence)
128-
noexcept(__nothrow_decay_copyable<_Adaptor> && __nothrow_decay_copyable<_Sequence>)
128+
noexcept(__nothrow_decay_copyable<_Adaptor, _Sequence>)
129129
-> __operation<_Sequence, _Receiver, _Adaptor>
130130
{
131131
return {static_cast<_Sequence&&>(__sequence),
@@ -138,8 +138,8 @@ namespace experimental::execution
138138
{
139139
template <sender _Sequence, __sender_adaptor_closure _Adaptor>
140140
auto operator()(_Sequence&& __sndr, _Adaptor&& __adaptor) const
141-
noexcept(__nothrow_decay_copyable<_Sequence> && __nothrow_decay_copyable<_Adaptor>)
142-
-> __well_formed_sequence_sender auto
141+
noexcept(__nothrow_decay_copyable<_Sequence, _Adaptor>) //
142+
-> __well_formed_sequence_sender auto
143143
{
144144
return make_sequence_expr<transform_each_t>(static_cast<_Adaptor&&>(__adaptor),
145145
static_cast<_Sequence&&>(__sndr));

include/exec/sequence_senders.hpp

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,10 @@ namespace experimental::execution
230230
template <class... _Senders>
231231
struct item_types
232232
{
233-
template <class _Fn, class _Continuation = STDEXEC::__qq<STDEXEC::__mlist>>
234-
static constexpr auto __transform(_Fn __fn, _Continuation __continuation = {})
233+
template <class _Transform, class _Reduce>
234+
static constexpr auto __transform([[maybe_unused]] _Transform _transform, _Reduce _reduce)
235235
{
236-
return __continuation(__fn.template operator()<_Senders>()...);
236+
return _reduce(_transform.template operator()<_Senders>()...);
237237
}
238238
};
239239

@@ -253,42 +253,6 @@ namespace experimental::execution
253253
struct _FAILED_TO_COMPUTE_SEQUENCE_ITEM_TYPES_
254254
{};
255255

256-
#if STDEXEC_NO_STDCPP_CONSTEXPR_EXCEPTIONS()
257-
258-
template <class... _What, class... _Values>
259-
[[nodiscard]]
260-
consteval auto __invalid_item_types(_Values...)
261-
{
262-
return STDEXEC::__mexception<_What...>();
263-
}
264-
265-
#else // ^^^ no constexpr exceptions ^^^ / vvv constexpr exceptions vvv
266-
267-
// C++26, https://wg21.link/p3068
268-
template <class _What, class... _More, class... _Values>
269-
[[noreturn, nodiscard]]
270-
consteval auto __invalid_item_types([[maybe_unused]] _Values... __values) -> item_types<>
271-
{
272-
if constexpr (sizeof...(_Values) == 1)
273-
{
274-
throw __sequence_type_check_failure<_Values..., _What, _More...>(__values...);
275-
}
276-
else
277-
{
278-
throw __sequence_type_check_failure<STDEXEC::__tuple<_Values...>, _What, _More...>(
279-
STDEXEC::__tuple{__values...});
280-
}
281-
}
282-
283-
#endif // ^^^ constexpr exceptions ^^^
284-
285-
template <class... _What>
286-
[[nodiscard]]
287-
consteval auto __invalid_item_types(STDEXEC::__mexception<_What...>)
288-
{
289-
return exec::__invalid_item_types<_What...>();
290-
}
291-
292256
template <class _Sequence, class... _Env>
293257
using __unrecognized_sequence_error_t =
294258
STDEXEC::__mexception<STDEXEC::_WHAT_(_UNRECOGNIZED_SEQUENCE_TYPE_),
@@ -376,11 +340,12 @@ namespace experimental::execution
376340
}
377341
else if constexpr (sizeof...(_Env) == 0)
378342
{
379-
return STDEXEC::__dependent_sender<_Sequence>();
343+
return STDEXEC::__dependent_sender_r<item_types<>, _Sequence>();
380344
}
381345
else
382346
{
383-
return __unrecognized_sequence_error_t<_Sequence, _Env...>();
347+
return STDEXEC::__throw_compile_time_error_r<item_types<>>(
348+
__unrecognized_sequence_error_t<_Sequence, _Env...>());
384349
}
385350
}
386351

@@ -591,6 +556,46 @@ namespace experimental::execution
591556
_Data __data_{};
592557
};
593558

559+
#if STDEXEC_NO_STDCPP_CONSTEXPR_EXCEPTIONS()
560+
561+
template <class... _What, class... _Values>
562+
[[nodiscard]]
563+
consteval auto __invalid_item_types(_Values...)
564+
{
565+
return STDEXEC::__mexception<_What...>();
566+
}
567+
568+
#else // ^^^ no constexpr exceptions ^^^ / vvv constexpr exceptions vvv
569+
570+
// C++26, https://wg21.link/p3068
571+
template <class _What, class... _More, class... _Values>
572+
[[noreturn, nodiscard]]
573+
consteval auto __invalid_item_types([[maybe_unused]] _Values... __values) -> item_types<>
574+
{
575+
if constexpr (STDEXEC::__same_as<_What, STDEXEC::dependent_sender_error>)
576+
{
577+
throw STDEXEC::__mexception<STDEXEC::dependent_sender_error, _More...>();
578+
}
579+
else if constexpr (sizeof...(_Values) == 1)
580+
{
581+
throw __sequence_type_check_failure<_Values..., _What, _More...>(__values...);
582+
}
583+
else
584+
{
585+
throw __sequence_type_check_failure<STDEXEC::__tuple<_Values...>, _What, _More...>(
586+
STDEXEC::__tuple<_Values...>{__values...});
587+
}
588+
}
589+
590+
#endif // ^^^ constexpr exceptions ^^^
591+
592+
template <class... _What>
593+
[[nodiscard]]
594+
consteval auto __invalid_item_types(STDEXEC::__mexception<_What...>)
595+
{
596+
return exec::__invalid_item_types<_What...>();
597+
}
598+
594599
struct _MISSING_SET_NEXT_OVERLOAD_FOR_ITEM_
595600
{};
596601

include/stdexec/__detail/__basic_sender.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,8 @@ namespace STDEXEC
369369
}
370370
else
371371
{
372-
return __throw_compile_time_error(__unrecognized_sender_error_t<_Self, _Env...>());
372+
return STDEXEC::__throw_compile_time_error(
373+
__unrecognized_sender_error_t<_Self, _Env...>());
373374
}
374375
}
375376

0 commit comments

Comments
 (0)