Skip to content

Commit a8449ab

Browse files
authored
Merge pull request #2442 from ericniebler/fix-functional-composed
`__composed<F,F>` should not inherit from `F` twice
2 parents f71dc7d + 9838d0d commit a8449ab

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

‎include/stdexec/functional.hpp‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ import stdexec;
3232
# include <functional>
3333
# endif
3434

35+
# if STDEXEC_CLANG() && STDEXEC_CLANG_VERSION < 1900
36+
# define STDEXEC_COMPOSED_NO_UNIQUE_ADDRESS
37+
# else
38+
# define STDEXEC_COMPOSED_NO_UNIQUE_ADDRESS STDEXEC_ATTRIBUTE(no_unique_address)
39+
# endif
40+
3541
// NOLINTNEXTLINE(bugprone-std-namespace-modification, modernize-concat-nested-namespaces)
3642
namespace STDEXEC
3743
{
3844
template <class _Fun0, class _Fun1>
39-
struct STDEXEC_ATTRIBUTE(empty_bases) __composed
40-
: _Fun0
41-
, _Fun1
45+
struct __composed
4246
{
4347
// clang-format off
4448
template <class _Self, class... _Ts>
@@ -48,9 +52,12 @@ namespace STDEXEC
4852
STDEXEC_ATTRIBUTE(host, device, always_inline)
4953
constexpr STDEXEC_EXPLICIT_THIS_BEGIN(auto operator())(this _Self &&__self, _Ts &&...__ts)
5054
STDEXEC_AUTO_RETURN(
51-
static_cast<__copy_cvref_t<_Self, _Fun0> &&>(__self)(
52-
static_cast<__copy_cvref_t<_Self, _Fun1> &&>(__self)(static_cast<_Ts &&>(__ts)...)))
55+
static_cast<_Self &&>(__self).__fun0_(
56+
static_cast<_Self &&>(__self).__fun1_(static_cast<_Ts &&>(__ts)...)))
5357
STDEXEC_EXPLICIT_THIS_END(operator())
58+
59+
STDEXEC_COMPOSED_NO_UNIQUE_ADDRESS _Fun0 __fun0_;
60+
STDEXEC_COMPOSED_NO_UNIQUE_ADDRESS _Fun1 __fun1_;
5461
// clang-format on
5562
};
5663

@@ -491,4 +498,6 @@ namespace STDEXEC
491498
}
492499
} // namespace STDEXEC
493500

501+
# undef STDEXEC_COMPOSED_NO_UNIQUE_ADDRESS
502+
494503
#endif // !STDEXEC_USE_MODULES() || defined(STDEXEC_IN_MODULE_PURVIEW)

0 commit comments

Comments
 (0)