From 9838d0d38d711da3dd8ef699f57bcf04bc8e4db3 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Tue, 10 Nov 2026 16:09:09 +0000 Subject: [PATCH] `__composed` should not inherit from `F` twice fixes #2440 --- include/stdexec/functional.hpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/include/stdexec/functional.hpp b/include/stdexec/functional.hpp index e4bf8b7b0..9e7d3f799 100644 --- a/include/stdexec/functional.hpp +++ b/include/stdexec/functional.hpp @@ -32,13 +32,17 @@ import stdexec; # include # endif +# if STDEXEC_CLANG() && STDEXEC_CLANG_VERSION < 1900 +# define STDEXEC_COMPOSED_NO_UNIQUE_ADDRESS +# else +# define STDEXEC_COMPOSED_NO_UNIQUE_ADDRESS STDEXEC_ATTRIBUTE(no_unique_address) +# endif + // NOLINTNEXTLINE(bugprone-std-namespace-modification, modernize-concat-nested-namespaces) namespace STDEXEC { template - struct STDEXEC_ATTRIBUTE(empty_bases) __composed - : _Fun0 - , _Fun1 + struct __composed { // clang-format off template @@ -48,9 +52,12 @@ namespace STDEXEC STDEXEC_ATTRIBUTE(host, device, always_inline) constexpr STDEXEC_EXPLICIT_THIS_BEGIN(auto operator())(this _Self &&__self, _Ts &&...__ts) STDEXEC_AUTO_RETURN( - static_cast<__copy_cvref_t<_Self, _Fun0> &&>(__self)( - static_cast<__copy_cvref_t<_Self, _Fun1> &&>(__self)(static_cast<_Ts &&>(__ts)...))) + static_cast<_Self &&>(__self).__fun0_( + static_cast<_Self &&>(__self).__fun1_(static_cast<_Ts &&>(__ts)...))) STDEXEC_EXPLICIT_THIS_END(operator()) + + STDEXEC_COMPOSED_NO_UNIQUE_ADDRESS _Fun0 __fun0_; + STDEXEC_COMPOSED_NO_UNIQUE_ADDRESS _Fun1 __fun1_; // clang-format on }; @@ -491,4 +498,6 @@ namespace STDEXEC } } // namespace STDEXEC +# undef STDEXEC_COMPOSED_NO_UNIQUE_ADDRESS + #endif // !STDEXEC_USE_MODULES() || defined(STDEXEC_IN_MODULE_PURVIEW)