@@ -540,6 +540,8 @@ namespace stdexec {
540540# include < cuda_runtime_api.h>
541541#endif
542542
543+ // clang-format off
544+
543545// The following macros are used to conditionally compile exception handling code. They
544546// are used in the same way as `try` and `catch`, but they allow for different behavior
545547// based on whether exceptions are enabled or not, and whether the code is being compiled
@@ -559,28 +561,28 @@ namespace stdexec {
559561// printf("unknown error\n");
560562// }
561563#if STDEXEC_STD_NO_EXCEPTIONS()
562- # define STDEXEC_TRY if constexpr (true )
563- # define STDEXEC_CATCH (...) \
564- else if constexpr ([[maybe_unused]] __VA_ARGS__ = ::stdexec::_catch_any_lvalue{}; false )
565- # define STDEXEC_CATCH_ALL \
566- else if constexpr (true ) { \
567- } \
568- else
569- # define STDEXEC_THROW (...) ::stdexec::__terminate()
564+ # define STDEXEC_TRY if constexpr (true ) {
565+ # define STDEXEC_CATCH (...) } else if constexpr (__VA_ARGS__ = ::stdexec::__catch_any_lvalue; false ) {
566+ # define STDEXEC_CATCH_ALL } else if constexpr (true ) {} else
567+ # define STDEXEC_THROW (...) ::stdexec::__terminate()
568+ # define STDEXEC_CATCH_FALLTHROUGH } else {}
570569#else
571- # define STDEXEC_TRY try
572- # define STDEXEC_CATCH catch
573- # define STDEXEC_CATCH_ALL STDEXEC_CATCH (...)
574- # define STDEXEC_THROW (...) throw __VA_ARGS__
570+ # define STDEXEC_TRY try
571+ # define STDEXEC_CATCH catch
572+ # define STDEXEC_CATCH_ALL catch (...)
573+ # define STDEXEC_THROW (...) throw __VA_ARGS__
574+ # define STDEXEC_CATCH_FALLTHROUGH
575575#endif
576576
577+ // clang-format on
578+
577579namespace stdexec {
578580 // Used by the STDEXEC_CATCH macro to provide a stub initialization of the exception object.
579- struct _catch_any_lvalue {
581+ constexpr struct __catch_any_lvalue_t {
580582 template <class _Tp >
581583 STDEXEC_ATTRIBUTE (host, device)
582584 operator _Tp&() const noexcept ;
583- };
585+ } __catch_any_lvalue{} ;
584586
585587 STDEXEC_ATTRIBUTE (noreturn, host, device)
586588 inline void __terminate () noexcept {
0 commit comments