From 0bdadb6f9eaafd0dc67152c13f7f4a64064f67ae Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Tue, 25 Feb 2025 08:52:18 -0800 Subject: [PATCH 1/3] drop support for pointers as receivers --- .../ustdex/detail/completion_signatures.hpp | 90 ++++++++++--------- include/ustdex/detail/concepts.hpp | 31 ++++--- include/ustdex/detail/conditional.hpp | 22 ++--- include/ustdex/detail/continue_on.hpp | 24 ++--- include/ustdex/detail/cpos.hpp | 31 +------ include/ustdex/detail/env.hpp | 38 +------- include/ustdex/detail/fwd_rcvr.hpp | 68 -------------- include/ustdex/detail/let_value.hpp | 43 +++++---- include/ustdex/detail/rcvr_ref.hpp | 45 ++++++---- include/ustdex/detail/sequence.hpp | 25 +++--- include/ustdex/detail/start_on.hpp | 27 +++--- include/ustdex/detail/then.hpp | 24 ++--- include/ustdex/detail/when_all.hpp | 3 +- include/ustdex/detail/write_env.hpp | 11 ++- 14 files changed, 195 insertions(+), 287 deletions(-) delete mode 100644 include/ustdex/detail/fwd_rcvr.hpp diff --git a/include/ustdex/detail/completion_signatures.hpp b/include/ustdex/detail/completion_signatures.hpp index 0a40609..ad4e771 100644 --- a/include/ustdex/detail/completion_signatures.hpp +++ b/include/ustdex/detail/completion_signatures.hpp @@ -66,12 +66,6 @@ struct _concat_completion_signatures_fn -> _concat_completion_signatures_t; }; -#if defined(__CUDA_ARCH__) -extern USTDEX_DEVICE const _concat_completion_signatures_fn concat_completion_signatures; -#else -extern const _concat_completion_signatures_fn concat_completion_signatures; -#endif - #if defined(__cpp_constexpr_exceptions) // C++26, https://wg21.link/p3068 template [[noreturn, nodiscard]] constexpr completion_signatures<> invalid_completion_signature(Values... values); @@ -105,28 +99,30 @@ struct USTDEX_TYPE_VISIBILITY_DEFAULT completion_signatures constexpr completion_signatures() = default; template - USTDEX_API static constexpr auto count(Tag) noexcept -> std::size_t; + USTDEX_API constexpr auto count(Tag) const noexcept -> std::size_t; template - USTDEX_API static constexpr auto apply(Fn) -> _call_result_t; + USTDEX_API constexpr auto apply(Fn) const -> _call_result_t; template - USTDEX_API static constexpr auto filter(Fn) -> _concat_completion_signatures_t<_completion_if...>; + USTDEX_API constexpr auto filter(Fn) const -> _concat_completion_signatures_t<_completion_if...>; template - USTDEX_API static constexpr auto select(Tag) noexcept; + USTDEX_API constexpr auto select(Tag) const noexcept; template - USTDEX_API static constexpr auto transform_reduce(Transform, Reduce) + USTDEX_API constexpr auto transform_reduce(Transform, Reduce) const -> _call_result_t...>; template USTDEX_API constexpr auto operator+(const completion_signatures&) const noexcept; }; +completion_signatures() -> completion_signatures<>; + template template -USTDEX_API constexpr std::size_t completion_signatures::count(Tag) noexcept +USTDEX_API constexpr std::size_t completion_signatures::count(Tag) const noexcept { if constexpr (Tag() == set_value) { @@ -142,11 +138,9 @@ USTDEX_API constexpr std::size_t completion_signatures::count(Tag) noex } } -completion_signatures() -> completion_signatures<>; - template template -USTDEX_API constexpr auto completion_signatures::apply(Fn _fn) -> _call_result_t +USTDEX_API constexpr auto completion_signatures::apply(Fn _fn) const -> _call_result_t { return _fn(static_cast(nullptr)...); } @@ -163,7 +157,7 @@ USTDEX_API constexpr auto _filer_one(Fn _fn, Sig* _sig) -> _completion_if template -USTDEX_API constexpr auto completion_signatures::filter(Fn _fn) +USTDEX_API constexpr auto completion_signatures::filter(Fn _fn) const -> _concat_completion_signatures_t<_completion_if...> { return concat_completion_signatures(ustdex::_filer_one(_fn, static_cast(nullptr))...); @@ -171,7 +165,7 @@ USTDEX_API constexpr auto completion_signatures::filter(Fn _fn) template template -USTDEX_API constexpr auto completion_signatures::select(Tag) noexcept +USTDEX_API constexpr auto completion_signatures::select(Tag) const noexcept { if constexpr (Tag() == set_value) { @@ -189,7 +183,7 @@ USTDEX_API constexpr auto completion_signatures::select(Tag) noexcept template template -USTDEX_API constexpr auto completion_signatures::transform_reduce(Transform _transform, Reduce _reduce) +USTDEX_API constexpr auto completion_signatures::transform_reduce(Transform _transform, Reduce _reduce) const -> _call_result_t...> { return _reduce(_transform(static_cast(nullptr))...); @@ -210,8 +204,8 @@ struct USTDEX_TYPE_VISIBILITY_DEFAULT _compile_time_error // : ::std::exception }; template -struct USTDEX_TYPE_VISIBILITY_DEFAULT _sender_type_check_failure - : _compile_time_error<_sender_type_check_failure> +struct USTDEX_TYPE_VISIBILITY_DEFAULT +_sender_type_check_failure : _compile_time_error<_sender_type_check_failure> { _sender_type_check_failure() = default; @@ -276,13 +270,14 @@ template } #else -# define USTDEX_PP_EAT_AUTO_auto(ID) ID USTDEX_PP_EAT USTDEX_PP_LPAREN +# define USTDEX_PP_EAT_AUTO_auto(ID) ID USTDEX_PP_EAT USTDEX_PP_LPAREN +# define USTDEX_PP_EXPAND_AUTO_auto(_ID) auto _ID # define USTDEX_LET_COMPLETIONS_ID(...) \ USTDEX_PP_EXPAND(USTDEX_PP_CAT(USTDEX_PP_EAT_AUTO_, __VA_ARGS__) USTDEX_PP_RPAREN) # define USTDEX_LET_COMPLETIONS(...) \ - if constexpr (__VA_ARGS__; \ + if constexpr (USTDEX_PP_CAT(USTDEX_PP_EXPAND_AUTO_, __VA_ARGS__); \ !::ustdex::_valid_completion_signatures) \ { \ return USTDEX_LET_COMPLETIONS_ID(__VA_ARGS__); \ @@ -302,11 +297,16 @@ template } #endif +USTDEX_PRAGMA_PUSH() +// warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in +// binary operator ',' used +USTDEX_PRAGMA_IGNORE_MSVC(4913) + #define USTDEX_GET_COMPLSIGS(...) std::remove_reference_t::template get_completion_signatures<__VA_ARGS__>() -#define USTDEX_CHECKED_COMPLSIGS(...) (__VA_ARGS__, ustdex::_checked_complsigs()) +#define USTDEX_CHECKED_COMPLSIGS(...) (__VA_ARGS__, void(), ustdex::_checked_complsigs()) -struct CHECKED +struct A_GET_COMPLETION_SIGNATURES_CUSTOMIZATION_RETURNED_A_TYPE_THAT_IS_NOT_A_COMPLETION_SIGNATURES_SPECIALIZATION {}; template @@ -320,7 +320,9 @@ USTDEX_TRIVIAL_API USTDEX_CONSTEVAL auto _checked_complsigs() } else { - return invalid_completion_signature(); + return invalid_completion_signature< + A_GET_COMPLETION_SIGNATURES_CUSTOMIZATION_RETURNED_A_TYPE_THAT_IS_NOT_A_COMPLETION_SIGNATURES_SPECIALIZATION, + WITH_SIGNATURES(Completions)>(); } } } @@ -344,7 +346,7 @@ inline constexpr bool _has_get_completion_signatures = ); // clang-format on -struct NO_COMPLETIONS +struct COULD_NOT_DETERMINE_COMPLETION_SIGNATURES_FOR_THIS_SENDER {}; template @@ -369,24 +371,28 @@ USTDEX_TRIVIAL_API USTDEX_CONSTEVAL auto _get_completion_signatures_helper() } else { - return invalid_completion_signature(); + return invalid_completion_signature(); } } -template -USTDEX_TRIVIAL_API USTDEX_CONSTEVAL auto get_completion_signatures() -{ - return ustdex::_get_completion_signatures_helper(); -} - -template +template USTDEX_TRIVIAL_API USTDEX_CONSTEVAL auto get_completion_signatures() { - // BUGBUG TODO: - // Apply a lazy sender transform if one exists before computing the completion signatures: - // using NewSndr = _transform_sender_result_t<_late_domain_of_t, Sndr, Env>; - using NewSndr = Sndr; - return ustdex::_get_completion_signatures_helper(); + static_assert(sizeof...(Env) <= 1, "At most one environment is allowed."); + if constexpr (sizeof...(Env) == 0) + { + return ustdex::_get_completion_signatures_helper(); + } + else + { + // BUGBUG TODO: + // Apply a lazy sender transform if one exists before computing the completion signatures: + // using NewSndr = _transform_sender_result_t<_late_domain_of_t, Sndr, Env>; + using NewSndr = Sndr; + return ustdex::_get_completion_signatures_helper(); + } } // BUGBUG TODO @@ -399,8 +405,10 @@ constexpr auto get_child_completion_signatures() return ustdex::get_completion_signatures<_copy_cvref_t, FWD_ENV_T...>(); } -// #undef USTDEX_GET_COMPLSIGS -// #undef USTDEX_CHECKED_COMPLSIGS +#undef USTDEX_GET_COMPLSIGS +#undef USTDEX_CHECKED_COMPLSIGS + +USTDEX_PRAGMA_POP() template using _partitioned_completions_of = typename Completions::_partitioned; diff --git a/include/ustdex/detail/concepts.hpp b/include/ustdex/detail/concepts.hpp index ae7deb0..f859c1f 100644 --- a/include/ustdex/detail/concepts.hpp +++ b/include/ustdex/detail/concepts.hpp @@ -27,13 +27,6 @@ namespace ustdex { -// Utilities: -template -USTDEX_API constexpr bool _is_constexpr_helper(Ty) -{ - return true; -} - // Receiver concepts: template USTDEX_CONCEPT receiver = // @@ -76,7 +69,7 @@ USTDEX_CONCEPT _is_awaitable = false; // TODO: Implement this concept. // Sender traits: template -USTDEX_API constexpr bool __enable_sender() +USTDEX_API constexpr bool _enable_sender() { if constexpr (_is_sender) { @@ -89,9 +82,25 @@ USTDEX_API constexpr bool __enable_sender() } template -inline constexpr bool enable_sender = __enable_sender(); +inline constexpr bool enable_sender = _enable_sender(); // Sender concepts: +template +struct _completions_tester +{ + template (), true)> + USTDEX_API static constexpr auto _is_valid(int) -> bool + { + return _valid_completion_signatures>; + } + + template + USTDEX_API static constexpr auto _is_valid(long) -> bool + { + return false; + } +}; + template USTDEX_CONCEPT sender = // USTDEX_REQUIRES_EXPR((Sndr)) // @@ -108,9 +117,7 @@ USTDEX_CONCEPT sender_in = // requires(sender), // requires(sizeof...(Env) <= 1), // requires((_queryable && ...)), // - requires( // - std::bool_constant())>::value), // - requires(_valid_completion_signatures())>) // + requires(_completions_tester::template _is_valid(0)) // ); template diff --git a/include/ustdex/detail/conditional.hpp b/include/ustdex/detail/conditional.hpp index 955cce1..a8c0a7b 100644 --- a/include/ustdex/detail/conditional.hpp +++ b/include/ustdex/detail/conditional.hpp @@ -103,16 +103,11 @@ struct _cond_t using _data_t = _data; using _env_t = FWD_ENV_T>; - USTDEX_API friend _env_t get_env(const _opstate* _self) noexcept - { - return get_env(_self->_rcvr_); - } - template using _opstate_t = // _m_list< // - connect_result_t<_call_result_t>, _rcvr_ref_t>, - connect_result_t<_call_result_t>, _rcvr_ref_t>>; + connect_result_t<_call_result_t>, _rcvr_ref>, + connect_result_t<_call_result_t>, _rcvr_ref>>; using _next_ops_variant_t = // _value_types, _opstate_t, _m_concat_into_q<_variant>::call>; @@ -120,7 +115,7 @@ struct _cond_t USTDEX_API _opstate(Sndr&& _sndr, Rcvr&& _rcvr, _data_t&& _data) : _rcvr_{static_cast(_rcvr)} , _data_{static_cast<_data_t&&>(_data)} - , _op_{ustdex::connect(static_cast(_sndr), this)} + , _op_{ustdex::connect(static_cast(_sndr), _rcvr_ref{*this})} {} USTDEX_API void start() noexcept @@ -136,12 +131,12 @@ struct _cond_t ({ // if (static_cast(_data_._pred_)(_as...)) { - auto& _op = _ops_._emplace_from(connect, static_cast(_data_._then_)(_just), _rcvr_ref(_rcvr_)); + auto& _op = _ops_._emplace_from(connect, static_cast(_data_._then_)(_just), _rcvr_ref{_rcvr_}); ustdex::start(_op); } else { - auto& _op = _ops_._emplace_from(connect, static_cast(_data_._else_)(_just), _rcvr_ref(_rcvr_)); + auto& _op = _ops_._emplace_from(connect, static_cast(_data_._else_)(_just), _rcvr_ref{_rcvr_}); ustdex::start(_op); } }), @@ -163,9 +158,14 @@ struct _cond_t ustdex::set_stopped(static_cast(_rcvr_)); } + USTDEX_API auto get_env() const noexcept -> _env_t + { + return ustdex::get_env(_rcvr_); + } + Rcvr _rcvr_; _data_t _data_; - connect_result_t _op_; + connect_result_t> _op_; _next_ops_variant_t _ops_; }; diff --git a/include/ustdex/detail/continue_on.hpp b/include/ustdex/detail/continue_on.hpp index ee250de..ee05a2a 100644 --- a/include/ustdex/detail/continue_on.hpp +++ b/include/ustdex/detail/continue_on.hpp @@ -23,8 +23,8 @@ #include "exception.hpp" #include "meta.hpp" #include "queries.hpp" +#include "rcvr_ref.hpp" #include "tuple.hpp" -#include "utility.hpp" #include "variant.hpp" #include "prologue.hpp" @@ -116,19 +116,10 @@ struct USTDEX_TYPE_VISIBILITY_DEFAULT continue_on_t using _result_t = typename completion_signatures_of_t::template _transform_q<_decayed_tuple, _variant>; - USTDEX_API friend auto get_env(const _opstate_t* _self) noexcept -> _env_t - { - return ustdex::get_env(_self->_rcvr_._rcvr); - } - - _rcvr_t _rcvr_; - connect_result_t _opstate1_; - connect_result_t, _rcvr_t*> _opstate2_; - USTDEX_API _opstate_t(CvSndr&& _sndr, Sch _sch, Rcvr _rcvr) : _rcvr_{static_cast(_rcvr), {}, nullptr} - , _opstate1_{ustdex::connect(static_cast(_sndr), this)} - , _opstate2_{ustdex::connect(schedule(_sch), &_rcvr_)} + , _opstate1_{ustdex::connect(static_cast(_sndr), _rcvr_ref{*this})} + , _opstate2_{ustdex::connect(schedule(_sch), _rcvr_ref{_rcvr_})} {} USTDEX_IMMOVABLE(_opstate_t); @@ -157,6 +148,15 @@ struct USTDEX_TYPE_VISIBILITY_DEFAULT continue_on_t _rcvr_._set_result(set_stopped_t()); ustdex::start(_opstate2_); } + + USTDEX_API auto get_env() const noexcept -> _env_t + { + return ustdex::get_env(_rcvr_._rcvr); + } + + _rcvr_t _rcvr_; + connect_result_t> _opstate1_; + connect_result_t, _rcvr_ref<_rcvr_t>> _opstate2_; }; template diff --git a/include/ustdex/detail/cpos.hpp b/include/ustdex/detail/cpos.hpp index 0019975..dd98788 100644 --- a/include/ustdex/detail/cpos.hpp +++ b/include/ustdex/detail/cpos.hpp @@ -100,15 +100,6 @@ inline constexpr struct set_value_t : _completion_tag<_value> static_assert(noexcept(static_cast(_rcvr).set_value(static_cast(_ts)...))); static_cast(_rcvr).set_value(static_cast(_ts)...); } - - template - USTDEX_TRIVIAL_API auto operator()(Rcvr* _rcvr, Ts&&... _ts) const noexcept - -> decltype(static_cast(*_rcvr).set_value(static_cast(_ts)...)) - { - static_assert(std::is_same_v(*_rcvr).set_value(static_cast(_ts)...)), void>); - static_assert(noexcept(static_cast(*_rcvr).set_value(static_cast(_ts)...))); - static_cast(*_rcvr).set_value(static_cast(_ts)...); - } } set_value{}; inline constexpr struct set_error_t : _completion_tag<_error> @@ -121,15 +112,6 @@ inline constexpr struct set_error_t : _completion_tag<_error> static_assert(noexcept(static_cast(_rcvr).set_error(static_cast(_e)))); static_cast(_rcvr).set_error(static_cast(_e)); } - - template - USTDEX_TRIVIAL_API auto operator()(Rcvr* _rcvr, Ey&& _e) const noexcept - -> decltype(static_cast(*_rcvr).set_error(static_cast(_e))) - { - static_assert(std::is_same_v(*_rcvr).set_error(static_cast(_e))), void>); - static_assert(noexcept(static_cast(*_rcvr).set_error(static_cast(_e)))); - static_cast(*_rcvr).set_error(static_cast(_e)); - } } set_error{}; inline constexpr struct set_stopped_t : _completion_tag<_stopped> @@ -141,14 +123,6 @@ inline constexpr struct set_stopped_t : _completion_tag<_stopped> static_assert(noexcept(static_cast(_rcvr).set_stopped())); static_cast(_rcvr).set_stopped(); } - - template - USTDEX_TRIVIAL_API auto operator()(Rcvr* _rcvr) const noexcept -> decltype(static_cast(*_rcvr).set_stopped()) - { - static_assert(std::is_same_v(*_rcvr).set_stopped()), void>); - static_assert(noexcept(static_cast(*_rcvr).set_stopped())); - static_cast(*_rcvr).set_stopped(); - } } set_stopped{}; inline constexpr struct start_t @@ -164,10 +138,7 @@ inline constexpr struct start_t } start{}; // get_completion_signatures -template -USTDEX_TRIVIAL_API USTDEX_CONSTEVAL auto get_completion_signatures(); - -template +template USTDEX_TRIVIAL_API USTDEX_CONSTEVAL auto get_completion_signatures(); // connect diff --git a/include/ustdex/detail/env.hpp b/include/ustdex/detail/env.hpp index b5129db..01f5c35 100644 --- a/include/ustdex/detail/env.hpp +++ b/include/ustdex/detail/env.hpp @@ -141,48 +141,18 @@ struct USTDEX_TYPE_VISIBILITY_DEFAULT env template env(Envs...) -> env<_unwrap_reference_t...>; -using empty_env = env<>; - -namespace _adl -{ -template -USTDEX_TRIVIAL_API auto get_env(Ty* _ty) noexcept // - -> decltype(_ty->get_env()) -{ - static_assert(noexcept(_ty->get_env())); - return _ty->get_env(); -} - -struct _get_env_t -{ - template - USTDEX_TRIVIAL_API auto operator()(Ty* _ty) const noexcept // - -> decltype(get_env(_ty)) - { - static_assert(noexcept(get_env(_ty))); - return get_env(_ty); - } -}; -} // namespace _adl +using empty_env [[deprecated("use ustdex::env<> instead")]] = env<>; struct get_env_t { template - USTDEX_TRIVIAL_API auto operator()(Ty&& _ty) const noexcept // - -> decltype(_ty.get_env()) + USTDEX_TRIVIAL_API auto operator()(Ty&& _ty) const noexcept -> decltype(_ty.get_env()) { static_assert(noexcept(_ty.get_env())); return _ty.get_env(); } - template - USTDEX_TRIVIAL_API auto operator()(Ty* _ty) const noexcept // - -> _call_result_t<_adl::_get_env_t, Ty*> - { - return _adl::_get_env_t()(_ty); - } - - USTDEX_TRIVIAL_API empty_env operator()(_ignore) const noexcept + USTDEX_TRIVIAL_API env<> operator()(_ignore) const noexcept { return {}; } @@ -196,7 +166,7 @@ inline constexpr get_env_t get_env{}; using namespace _region; template -using env_of_t = decltype(get_env(declval())); +using env_of_t = decltype(ustdex::get_env(declval())); } // namespace ustdex USTDEX_PRAGMA_POP() diff --git a/include/ustdex/detail/fwd_rcvr.hpp b/include/ustdex/detail/fwd_rcvr.hpp deleted file mode 100644 index a5eeb0e..0000000 --- a/include/ustdex/detail/fwd_rcvr.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License Version 2.0 with LLVM Exceptions - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * https://llvm.org/LICENSE.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef USTDEX_ASYNC_DETAIL_FWD_RCVR -#define USTDEX_ASYNC_DETAIL_FWD_RCVR - -#include "config.hpp" -#include "cpos.hpp" -#include "env.hpp" - -namespace ustdex -{ -template -struct _fwd_rcvr : Rcvr -{ - USTDEX_API decltype(auto) get_env() const noexcept - { - // TODO: only forward the "forwarding" queries: - return ustdex::get_env(static_cast(*this)); - } -}; - -template -struct _fwd_rcvr -{ - using receiver_concept = receiver_t; - Rcvr* _rcvr_; - - template - USTDEX_TRIVIAL_API void set_value(As&&... _as) noexcept - { - ustdex::set_value(_rcvr_); - } - - template - USTDEX_TRIVIAL_API void set_error(Error&& _error) noexcept - { - ustdex::set_error(_rcvr_, static_cast(_error)); - } - - USTDEX_TRIVIAL_API void set_stopped() noexcept - { - ustdex::set_stopped(_rcvr_); - } - - USTDEX_API decltype(auto) get_env() const noexcept - { - // TODO: only forward the "forwarding" queries: - return ustdex::get_env(_rcvr_); - } -}; -} // namespace ustdex - -#endif diff --git a/include/ustdex/detail/let_value.hpp b/include/ustdex/detail/let_value.hpp index b1237c4..44b461e 100644 --- a/include/ustdex/detail/let_value.hpp +++ b/include/ustdex/detail/let_value.hpp @@ -34,6 +34,7 @@ namespace ustdex { // Declare types to use for diagnostics: struct FUNCTION_MUST_RETURN_A_SENDER; +struct FUNCTION_RETURN_TYPE_IS_NOT_A_SENDER_IN_THE_CURRENT_ENVIRONMENT; // Forward-declate the let_* algorithm tag types: struct let_value_t; @@ -73,7 +74,7 @@ struct _let struct _opstate_fn { template - using call = connect_result_t<_call_result_t, _rcvr_ref_t>; + using call = connect_result_t<_call_result_t, _rcvr_ref>; }; /// @brief Computes the type of a variant of operation states to hold @@ -94,29 +95,17 @@ struct _let template struct USTDEX_TYPE_VISIBILITY_DEFAULT _opstate_t { - using _env_t = FWD_ENV_T>; - - USTDEX_API friend auto get_env(const _opstate_t* _self) noexcept -> _env_t - { - return ustdex::get_env(_self->_rcvr_); - } - using operation_state_concept = operation_state_t; + using _env_t = FWD_ENV_T>; // Compute the type of the variant of operation states using _opstate_variant_t = _opstate2_t; - Rcvr _rcvr_; - Fn _fn_; - _results _result_; - connect_result_t _opstate1_; - _opstate_variant_t _opstate2_; - USTDEX_API _opstate_t(CvSndr&& _sndr, Fn _fn, Rcvr _rcvr) noexcept( _nothrow_decay_copyable && _nothrow_connectable) : _rcvr_(static_cast(_rcvr)) , _fn_(static_cast(_fn)) - , _opstate1_(ustdex::connect(static_cast(_sndr), this)) + , _opstate1_(ustdex::connect(static_cast(_sndr), _rcvr_ref{*this})) {} USTDEX_API void start() noexcept @@ -137,7 +126,7 @@ struct _let // Call the function with the results and connect the resulting // sender, storing the operation state in _opstate2_. auto& _next_op = _opstate2_._emplace_from( - ustdex::connect, _tupl.apply(static_cast(_fn_), _tupl), ustdex::_rcvr_ref(_rcvr_)); + ustdex::connect, _tupl.apply(static_cast(_fn_), _tupl), ustdex::_rcvr_ref{_rcvr_}); ustdex::start(_next_op); }), USTDEX_CATCH(...) // @@ -169,6 +158,17 @@ struct _let { _complete(set_stopped_t()); } + + USTDEX_API auto get_env() const noexcept -> _env_t + { + return ustdex::get_env(_rcvr_); + } + + Rcvr _rcvr_; + Fn _fn_; + _results _result_; + connect_result_t> _opstate1_; + _opstate_variant_t _opstate2_; }; template @@ -190,16 +190,23 @@ struct _let WITH_FUNCTION(Fn), WITH_ARGUMENTS(std::decay_t & ...)>(); } - else if constexpr (!_is_sender<_call_result_t&...>>) + else if constexpr (!sender<_call_result_t&...>>) { return invalid_completion_signature & ...)>(); } + else if constexpr (!sender_in<_call_result_t&...>, Env...>) + { + return invalid_completion_signature & ...), + WITH_ENVIRONMENT(Env...)>(); + } else { - // TODO: test that Sndr satisfies sender_in using Sndr = _call_result_t&...>; // The function is callable with the arguments and returns a sender, but we // do not know whether connect will throw. diff --git a/include/ustdex/detail/rcvr_ref.hpp b/include/ustdex/detail/rcvr_ref.hpp index 071dc61..47bedbe 100644 --- a/include/ustdex/detail/rcvr_ref.hpp +++ b/include/ustdex/detail/rcvr_ref.hpp @@ -19,28 +19,43 @@ #define USTDEX_ASYNC_DETAIL_RCVR_REF #include "cpos.hpp" -#include "meta.hpp" // #include "prologue.hpp" namespace ustdex { -template -constexpr Rcvr* _rcvr_ref(Rcvr& _rcvr) noexcept +template > +struct _rcvr_ref { - return &_rcvr; -} - -template -constexpr Rcvr* _rcvr_ref(Rcvr* _rcvr) noexcept -{ - return _rcvr; -} - -template -using _rcvr_ref_t = decltype(ustdex::_rcvr_ref(declval())); - + using receiver_concept = receiver_t; + _Rcvr& _rcvr_; + + template + USTDEX_TRIVIAL_API void set_value(_As&&... _as) noexcept + { + static_cast<_Rcvr&&>(_rcvr_).set_value(static_cast<_As&&>(_as)...); + } + + template + USTDEX_TRIVIAL_API void set_error(_Error&& _err) noexcept + { + static_cast<_Rcvr&&>(_rcvr_).set_error(static_cast<_Error&&>(_err)); + } + + USTDEX_TRIVIAL_API void set_stopped() noexcept + { + static_cast<_Rcvr&&>(_rcvr_).set_stopped(); + } + + USTDEX_API auto get_env() const noexcept -> _Env + { + return ustdex::get_env(_rcvr_); + } +}; + +template +_rcvr_ref(_Rcvr&) -> _rcvr_ref<_Rcvr>; } // namespace ustdex #include "epilogue.hpp" diff --git a/include/ustdex/detail/sequence.hpp b/include/ustdex/detail/sequence.hpp index 1d58d5d..3aad248 100644 --- a/include/ustdex/detail/sequence.hpp +++ b/include/ustdex/detail/sequence.hpp @@ -21,9 +21,7 @@ #include "completion_signatures.hpp" #include "cpos.hpp" #include "exception.hpp" -#include "lazy.hpp" #include "rcvr_ref.hpp" -#include "variant.hpp" #include "prologue.hpp" @@ -48,20 +46,12 @@ struct _seq using _rcvr_t = typename _args_t::_rcvr_t; using _sndr1_t = typename _args_t::_sndr1_t; using _sndr2_t = typename _args_t::_sndr2_t; - - USTDEX_API friend env_of_t<_rcvr_t> get_env(const _opstate* _self) noexcept - { - return ustdex::get_env(_self->_rcvr_); - } - - _rcvr_t _rcvr_; - connect_result_t<_sndr1_t, _opstate*> _opstate1_; - connect_result_t<_sndr2_t, _rcvr_ref_t<_rcvr_t&>> _opstate2_; + using _env_t = env_of_t<_rcvr_t>; USTDEX_API _opstate(_sndr1_t&& _sndr1, _sndr2_t&& _sndr2, _rcvr_t&& _rcvr) : _rcvr_(static_cast<_rcvr_t&&>(_rcvr)) - , _opstate1_(ustdex::connect(static_cast<_sndr1_t&&>(_sndr1), this)) - , _opstate2_(ustdex::connect(static_cast<_sndr2_t&&>(_sndr2), _rcvr_ref(_rcvr_))) + , _opstate1_(ustdex::connect(static_cast<_sndr1_t&&>(_sndr1), _rcvr_ref{*this})) + , _opstate2_(ustdex::connect(static_cast<_sndr2_t&&>(_sndr2), _rcvr_ref{_rcvr_})) {} USTDEX_API void start() noexcept @@ -85,6 +75,15 @@ struct _seq { ustdex::set_stopped(static_cast<_rcvr_t&&>(_rcvr_)); } + + USTDEX_API auto get_env() const noexcept -> _env_t + { + return ustdex::get_env(_rcvr_); + } + + _rcvr_t _rcvr_; + connect_result_t<_sndr1_t, _rcvr_ref<_opstate, _env_t>> _opstate1_; + connect_result_t<_sndr2_t, _rcvr_ref<_rcvr_t>> _opstate2_; }; template diff --git a/include/ustdex/detail/start_on.hpp b/include/ustdex/detail/start_on.hpp index d54ccc8..fa9daec 100644 --- a/include/ustdex/detail/start_on.hpp +++ b/include/ustdex/detail/start_on.hpp @@ -21,10 +21,8 @@ #include "completion_signatures.hpp" #include "cpos.hpp" #include "queries.hpp" +#include "rcvr_ref.hpp" #include "rcvr_with_env.hpp" -#include "tuple.hpp" -#include "utility.hpp" -#include "variant.hpp" #include "prologue.hpp" @@ -47,21 +45,13 @@ inline constexpr struct start_on_t template struct USTDEX_TYPE_VISIBILITY_DEFAULT _opstate_t { - USTDEX_API friend env_of_t get_env(const _opstate_t* _self) noexcept - { - return ustdex::get_env(_self->_env_rcvr_._rcvr()); - } - using operation_state_concept = operation_state_t; - - _rcvr_with_env_t> _env_rcvr_; - connect_result_t, _opstate_t*> _opstate1_; - connect_result_t>*> _opstate2_; + using _env_t = env_of_t; USTDEX_API _opstate_t(Sch _sch, Rcvr _rcvr, CvSndr&& _sndr) : _env_rcvr_{static_cast(_rcvr), {_sch}} - , _opstate1_{connect(schedule(_env_rcvr_._env_._sch_), this)} - , _opstate2_{connect(static_cast(_sndr), &_env_rcvr_)} + , _opstate1_{connect(schedule(_env_rcvr_._env_._sch_), _rcvr_ref{*this})} + , _opstate2_{connect(static_cast(_sndr), _rcvr_ref{_env_rcvr_})} {} USTDEX_IMMOVABLE(_opstate_t); @@ -86,6 +76,15 @@ inline constexpr struct start_on_t { ustdex::set_stopped(static_cast(_env_rcvr_._rcvr())); } + + USTDEX_API auto get_env() const noexcept -> _env_t + { + return ustdex::get_env(_env_rcvr_._rcvr()); + } + + _rcvr_with_env_t> _env_rcvr_; + connect_result_t, _rcvr_ref<_opstate_t, _env_t>> _opstate1_; + connect_result_t>>> _opstate2_; }; template diff --git a/include/ustdex/detail/then.hpp b/include/ustdex/detail/then.hpp index 90de550..fda52bd 100644 --- a/include/ustdex/detail/then.hpp +++ b/include/ustdex/detail/then.hpp @@ -23,8 +23,7 @@ #include "cpos.hpp" #include "exception.hpp" #include "meta.hpp" -#include "tuple.hpp" -#include "utility.hpp" +#include "rcvr_ref.hpp" #include "prologue.hpp" @@ -95,21 +94,13 @@ struct _upon_t template struct USTDEX_TYPE_VISIBILITY_DEFAULT _opstate_t { - USTDEX_API friend env_of_t get_env(const _opstate_t* _self) noexcept - { - return ustdex::get_env(_self->_rcvr_); - } - using operation_state_concept = operation_state_t; - - Rcvr _rcvr_; - Fn _fn_; - connect_result_t _opstate_; + using _env_t = env_of_t; USTDEX_API _opstate_t(CvSndr&& _sndr, Rcvr _rcvr, Fn _fn) : _rcvr_{static_cast(_rcvr)} , _fn_{static_cast(_fn)} - , _opstate_{ustdex::connect(static_cast(_sndr), this)} + , _opstate_{ustdex::connect(static_cast(_sndr), _rcvr_ref{*this})} {} USTDEX_IMMOVABLE(_opstate_t); @@ -177,6 +168,15 @@ struct _upon_t { _complete(set_stopped_t()); } + + USTDEX_API auto get_env() const noexcept -> _env_t + { + return ustdex::get_env(_rcvr_); + } + + Rcvr _rcvr_; + Fn _fn_; + connect_result_t> _opstate_; }; template diff --git a/include/ustdex/detail/when_all.hpp b/include/ustdex/detail/when_all.hpp index 901a741..ef5014e 100644 --- a/include/ustdex/detail/when_all.hpp +++ b/include/ustdex/detail/when_all.hpp @@ -34,6 +34,7 @@ #include "variant.hpp" #include +#include #include "prologue.hpp" @@ -385,7 +386,7 @@ USTDEX_API constexpr auto when_all_t::_merge_completions(Completions... _cs) // Use USTDEX_LET_COMPLETIONS to ensure all completions are valid: USTDEX_LET_COMPLETIONS(auto(_tmp) = (completion_signatures{}, ..., _cs)) // NB: uses overloaded comma operator { - (void) _tmp; + std::ignore = _tmp; // silence unused variable warning auto _non_value_completions = concat_completion_signatures( completion_signatures(), transform_completion_signatures(_cs, _swallow_transform(), _decay_transform())...); diff --git a/include/ustdex/detail/write_env.hpp b/include/ustdex/detail/write_env.hpp index 666e7a6..1468eba 100644 --- a/include/ustdex/detail/write_env.hpp +++ b/include/ustdex/detail/write_env.hpp @@ -23,9 +23,8 @@ #include "cpos.hpp" #include "env.hpp" #include "exception.hpp" -#include "queries.hpp" +#include "rcvr_ref.hpp" #include "rcvr_with_env.hpp" -#include "utility.hpp" #include "prologue.hpp" @@ -39,12 +38,9 @@ struct write_env_t { using operation_state_concept = operation_state_t; - _rcvr_with_env_t _env_rcvr_; - connect_result_t*> _opstate_; - USTDEX_API explicit _opstate_t(Sndr&& _sndr, Env _env, Rcvr _rcvr) : _env_rcvr_{static_cast(_rcvr), static_cast(_env)} - , _opstate_(ustdex::connect(static_cast(_sndr), &_env_rcvr_)) + , _opstate_(ustdex::connect(static_cast(_sndr), _rcvr_ref{_env_rcvr_})) {} USTDEX_IMMOVABLE(_opstate_t); @@ -53,6 +49,9 @@ struct write_env_t { ustdex::start(_opstate_); } + + _rcvr_with_env_t _env_rcvr_; + connect_result_t>> _opstate_; }; template From 767cb45d6ac1fff61a3f88054600883c54eb7122 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Tue, 25 Feb 2025 09:53:20 -0800 Subject: [PATCH 2/3] try to work around msvc bug --- .clang-format | 36 ++++--------- examples/scratch.cpp | 4 +- .../ustdex/detail/completion_signatures.hpp | 8 +-- include/ustdex/detail/concepts.hpp | 54 ++++++++++--------- include/ustdex/detail/conditional.hpp | 8 +-- include/ustdex/detail/continue_on.hpp | 10 ++-- include/ustdex/detail/exception.hpp | 4 +- include/ustdex/detail/let_value.hpp | 6 +-- include/ustdex/detail/meta.hpp | 8 +-- include/ustdex/detail/preprocessor.hpp | 22 ++++---- include/ustdex/detail/read_env.hpp | 6 +-- include/ustdex/detail/run_loop.hpp | 24 ++++----- include/ustdex/detail/sequence.hpp | 10 ++-- include/ustdex/detail/stop_token.hpp | 4 +- include/ustdex/detail/sync_wait.hpp | 10 ++-- include/ustdex/detail/then.hpp | 14 ++--- include/ustdex/detail/type_traits.hpp | 3 ++ include/ustdex/detail/utility.hpp | 8 +-- include/ustdex/detail/when_all.hpp | 16 +++--- tests/common/error_scheduler.hpp | 6 +-- tests/common/impulse_scheduler.hpp | 6 +-- tests/common/inline_scheduler.hpp | 2 +- tests/common/stopped_scheduler.hpp | 2 +- tests/common/utility.hpp | 2 +- tests/test_continue_on.cpp | 2 +- 25 files changed, 133 insertions(+), 142 deletions(-) diff --git a/.clang-format b/.clang-format index e71e96f..cdd7fbc 100644 --- a/.clang-format +++ b/.clang-format @@ -4,14 +4,15 @@ BasedOnStyle: LLVM AccessModifierOffset: -2 AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: Consecutive -AlignConsecutiveBitFields: Consecutive -AlignConsecutiveMacros: Consecutive +AlignConsecutiveAssignments: AcrossEmptyLines +AlignConsecutiveBitFields: AcrossEmptyLines +AlignConsecutiveMacros: AcrossEmptyLines AlignEscapedNewlines: Left +AlignTrailingComments: + Kind: Always + OverEmptyLines: 1 AlignOperands: AlignAfterOperator AllowAllArgumentsOnNextLine: true -AlignTrailingComments: - Kind: Never AllowAllParametersOfDeclarationOnNextLine: true AllowAllConstructorInitializersOnNextLine: true AllowShortBlocksOnASingleLine: false @@ -96,9 +97,9 @@ IndentWidth: 2 KeepEmptyLinesAtTheStartOfBlocks: false MaxEmptyLinesToKeep: 1 Macros: -- USTDEX_TEMPLATE(...)=template<...> -- USTDEX_REQUIRES(...)=requires (...) -- USTDEX_CONCEPT=concept + - USTDEX_TEMPLATE(...)=template<__VA_ARGS__> + - USTDEX_REQUIRES(...)=requires (__VA_ARGS__) + - USTDEX_CONCEPT=concept /*****/ NamespaceIndentation: None PackConstructorInitializers: Never PenaltyBreakAssignment: 30 @@ -130,24 +131,5 @@ SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false Standard: c++20 -StatementMacros: [ - 'USTDEX_EXEC_CHECK_DISABLE', - 'CUB_NAMESPACE_BEGIN', - 'CUB_NAMESPACE_END', - 'THRUST_NAMESPACE_BEGIN', - 'THRUST_NAMESPACE_END', - 'LIBCUDACXX_BEGIN_NAMESPACE_STD', - 'LIBCUDACXX_END_NAMESPACE_STD', - 'LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION', - 'LIBCUDACXX_END_NAMESPACE_STD_NOVERSION', - 'LIBCUDACXX_BEGIN_NAMESPACE_RANGES', - 'LIBCUDACXX_END_NAMESPACE_RANGES', - 'LIBCUDACXX_BEGIN_NAMESPACE_RANGES_ABI', - 'LIBCUDACXX_END_NAMESPACE_RANGES_ABI', - 'LIBCUDACXX_BEGIN_NAMESPACE_CPO', - 'LIBCUDACXX_END_NAMESPACE_CPO', - 'LIBCUDACXX_BEGIN_NAMESPACE_VIEWS', - 'LIBCUDACXX_END_NAMESPACE_VIEWS', -] TabWidth: 2 UseTab: Never diff --git a/examples/scratch.cpp b/examples/scratch.cpp index 32a6381..6397036 100644 --- a/examples/scratch.cpp +++ b/examples/scratch.cpp @@ -53,7 +53,7 @@ static_assert(dependent_sender); int main() { thread_context ctx; - auto sch = ctx.get_scheduler(); + auto sch = ctx.get_scheduler(); auto work = just(1, 2, 3) // | then([](int a, int b, int c) { @@ -71,7 +71,7 @@ int main() }); sync_wait(s3); - auto [sch2] = sync_wait(read_env(get_scheduler)).value(); + auto [sch2] = sync_wait(read_env(get_scheduler)).value(); auto [i1, i2] = sync_wait(when_all(just(42), just(43))).value(); std::cout << i1 << ' ' << i2 << '\n'; diff --git a/include/ustdex/detail/completion_signatures.hpp b/include/ustdex/detail/completion_signatures.hpp index ad4e771..b581852 100644 --- a/include/ustdex/detail/completion_signatures.hpp +++ b/include/ustdex/detail/completion_signatures.hpp @@ -96,7 +96,7 @@ struct USTDEX_TYPE_VISIBILITY_DEFAULT completion_signatures template using call USTDEX_ATTR_NODEBUG_ALIAS = _m_call; - constexpr completion_signatures() = default; + constexpr completion_signatures() = default; template USTDEX_API constexpr auto count(Tag) const noexcept -> std::size_t; @@ -218,7 +218,7 @@ _sender_type_check_failure : _compile_time_error<_sender_type_check_failure::template get_completion_signatures<__VA_ARGS__>() +#define USTDEX_GET_COMPLSIGS(...) std::remove_reference_t::template get_completion_signatures<__VA_ARGS__>() #define USTDEX_CHECKED_COMPLSIGS(...) (__VA_ARGS__, void(), ustdex::_checked_complsigs()) @@ -411,7 +411,7 @@ constexpr auto get_child_completion_signatures() USTDEX_PRAGMA_POP() template -using _partitioned_completions_of = typename Completions::_partitioned; +using _partitioned_completions_of = typename Completions::_partitioned; constexpr int _invalid_disposition = -1; diff --git a/include/ustdex/detail/concepts.hpp b/include/ustdex/detail/concepts.hpp index f859c1f..6b4677d 100644 --- a/include/ustdex/detail/concepts.hpp +++ b/include/ustdex/detail/concepts.hpp @@ -25,16 +25,22 @@ #include "prologue.hpp" +#if USTDEX_MSVC() +# define USTDEX_BINARY_FOLD_EXPR(INIT, OP, ...) ustdex::_fold_expr_##OP +#else +# define USTDEX_BINARY_FOLD_EXPR(INIT, OP, ...) (INIT OP... OP __VA_ARGS__) +#endif + namespace ustdex { // Receiver concepts: template -USTDEX_CONCEPT receiver = // - USTDEX_REQUIRES_EXPR((Rcvr)) // - ( // - requires(_is_receiver>), // - requires(std::is_move_constructible_v>), // - requires(std::is_constructible_v, Rcvr>), // +USTDEX_CONCEPT receiver = // + USTDEX_REQUIRES_EXPR((Rcvr)) // + ( // + requires(_is_receiver>), // + requires(std::is_move_constructible_v>), // + requires(std::is_constructible_v, Rcvr>), // requires(std::is_nothrow_move_constructible_v>) // ); @@ -52,10 +58,10 @@ inline constexpr bool _has_completions> = (_valid_completion_for && ...); template -USTDEX_CONCEPT receiver_of = // - USTDEX_REQUIRES_EXPR((Rcvr, Completions)) // - ( // - requires(receiver), // +USTDEX_CONCEPT receiver_of = // + USTDEX_REQUIRES_EXPR((Rcvr, Completions)) // + ( // + requires(receiver), // requires(_has_completions, Completions>) // ); @@ -102,29 +108,29 @@ struct _completions_tester }; template -USTDEX_CONCEPT sender = // - USTDEX_REQUIRES_EXPR((Sndr)) // - ( // - requires(enable_sender>), // +USTDEX_CONCEPT sender = // + USTDEX_REQUIRES_EXPR((Sndr)) // + ( // + requires(enable_sender>), // requires(std::is_move_constructible_v>), // requires(std::is_constructible_v, Sndr>) // ); template -USTDEX_CONCEPT sender_in = // - USTDEX_REQUIRES_EXPR((Sndr, variadic Env)) // - ( // - requires(sender), // - requires(sizeof...(Env) <= 1), // - requires((_queryable && ...)), // +USTDEX_CONCEPT sender_in = // + USTDEX_REQUIRES_EXPR((Sndr, variadic Env)) // + ( // + requires(sender), // + requires(sizeof...(Env) <= 1), // + requires(USTDEX_BINARY_FOLD_EXPR(true, and, _queryable)), // requires(_completions_tester::template _is_valid(0)) // ); template -USTDEX_CONCEPT dependent_sender = // - USTDEX_REQUIRES_EXPR((Sndr)) // - ( // - requires(sender), // +USTDEX_CONCEPT dependent_sender = // + USTDEX_REQUIRES_EXPR((Sndr)) // + ( // + requires(sender), // requires(_is_dependent_sender()) // ); diff --git a/include/ustdex/detail/conditional.hpp b/include/ustdex/detail/conditional.hpp index a8c0a7b..f797edc 100644 --- a/include/ustdex/detail/conditional.hpp +++ b/include/ustdex/detail/conditional.hpp @@ -105,7 +105,7 @@ struct _cond_t template using _opstate_t = // - _m_list< // + _m_list< // connect_result_t<_call_result_t>, _rcvr_ref>, connect_result_t<_call_result_t>, _rcvr_ref>>; @@ -128,7 +128,7 @@ struct _cond_t { auto _just = just_from(_cond_t::_mk_complete_fn(static_cast(_as)...)); USTDEX_TRY( // - ({ // + ({ // if (static_cast(_data_._pred_)(_as...)) { auto& _op = _ops_._emplace_from(connect, static_cast(_data_._then_)(_just), _rcvr_ref{_rcvr_}); @@ -141,9 +141,9 @@ struct _cond_t } }), USTDEX_CATCH(...) // - ({ // + ({ // ustdex::set_error(static_cast(_rcvr_), ::std::current_exception()); - }) // + }) // ) } diff --git a/include/ustdex/detail/continue_on.hpp b/include/ustdex/detail/continue_on.hpp index ee05a2a..848f5f4 100644 --- a/include/ustdex/detail/continue_on.hpp +++ b/include/ustdex/detail/continue_on.hpp @@ -38,11 +38,11 @@ struct USTDEX_TYPE_VISIBILITY_DEFAULT continue_on_t using _set_value_tuple_t = _tuple; template - using _set_error_tuple_t = _tuple; + using _set_error_tuple_t = _tuple; using _set_stopped_tuple_t = _tuple; - using _complete_fn = void (*)(void*) noexcept; + using _complete_fn = void (*)(void*) noexcept; template struct USTDEX_TYPE_VISIBILITY_DEFAULT _rcvr_t @@ -69,13 +69,13 @@ struct USTDEX_TYPE_VISIBILITY_DEFAULT continue_on_t else { USTDEX_TRY( // - ({ // + ({ // _result_.template _emplace<_tupl_t>(Tag(), static_cast(_as)...); }), USTDEX_CATCH(...) // - ({ // + ({ // ustdex::set_error(static_cast(_rcvr_), ::std::current_exception()); - }) // + }) // ) } _complete_ = +[](void* _ptr) noexcept { diff --git a/include/ustdex/detail/exception.hpp b/include/ustdex/detail/exception.hpp index 9677827..7bd04cf 100644 --- a/include/ustdex/detail/exception.hpp +++ b/include/ustdex/detail/exception.hpp @@ -18,10 +18,10 @@ #ifndef USTDEX_ASYNC_DETAIL_EXCEPTION #define USTDEX_ASYNC_DETAIL_EXCEPTION -#include "config.hpp" // IWYU pragma: export +#include "config.hpp" // IWYU pragma: export #include "preprocessor.hpp" // IWYU pragma: export -#include // IWYU pragma: export +#include // IWYU pragma: export #if USTDEX_CUDA() # define USTDEX_CATCH(...) diff --git a/include/ustdex/detail/let_value.hpp b/include/ustdex/detail/let_value.hpp index 44b461e..064c253 100644 --- a/include/ustdex/detail/let_value.hpp +++ b/include/ustdex/detail/let_value.hpp @@ -119,7 +119,7 @@ struct _let if constexpr (Tag() == SetTag()) { USTDEX_TRY( // - ({ // + ({ // // Store the results so the lvalue refs we pass to the function // will be valid for the duration of the async op. auto& _tupl = _result_.template _emplace<_decayed_tuple>(static_cast(_as)...); @@ -130,9 +130,9 @@ struct _let ustdex::start(_next_op); }), USTDEX_CATCH(...) // - ({ // + ({ // ustdex::set_error(static_cast(_rcvr_), ::std::current_exception()); - }) // + }) // ) } else diff --git a/include/ustdex/detail/meta.hpp b/include/ustdex/detail/meta.hpp index 02c6d6f..9b25b9f 100644 --- a/include/ustdex/detail/meta.hpp +++ b/include/ustdex/detail/meta.hpp @@ -257,7 +257,7 @@ struct USTDEX_TYPE_VISIBILITY_DEFAULT ERROR : _merror_base // The following aliases are to simplify error propagation // in the completion signatures meta-programming. template - using call USTDEX_ATTR_NODEBUG_ALIAS = ERROR; + using call USTDEX_ATTR_NODEBUG_ALIAS = ERROR; using _partitioned USTDEX_ATTR_NODEBUG_ALIAS = ERROR; @@ -265,7 +265,7 @@ struct USTDEX_TYPE_VISIBILITY_DEFAULT ERROR : _merror_base using _value_types USTDEX_ATTR_NODEBUG_ALIAS = ERROR; template