Skip to content

Commit 8d25b94

Browse files
committed
fix search-n-replace bug
1 parent c58622e commit 8d25b94

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

include/stdexec/__detail/__any.hpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,9 @@ namespace STDEXEC::__any {
530530
class _Extension = __iabstract<_Interface>
531531
>
532532
struct __reference_model
533-
: _Interface<__mcall1<__bases_of<_Interface>, __reference_root<_Interface, _Value, _Extension>>> {
533+
: _Interface<
534+
__mcall1<__bases_of<_Interface>, __reference_root<_Interface, _Value, _Extension>>
535+
> {
534536
using __base_t =
535537
_Interface<__mcall1<__bases_of<_Interface>, __reference_root<_Interface, _Value, _Extension>>>;
536538
using __base_t::__base_t;
@@ -594,7 +596,7 @@ namespace STDEXEC::__any {
594596
struct interface : _Base {
595597
static_assert(std::popcount(_BufferAlignment) == 1, "BufferAlignment must be a power of two");
596598
using __bases_type = _BaseInterfaces;
597-
using __interface_type = __iabstract<_Interface, _BaseInterfaces>;
599+
using __this_interface_type = __iabstract<_Interface, _BaseInterfaces>;
598600
using _Base::__indirect_bind_;
599601
using _Base::__slice_to_;
600602
using _Base::_Base;
@@ -608,15 +610,16 @@ namespace STDEXEC::__any {
608610
: _Base::__buffer_alignment;
609611

610612
static constexpr bool __nothrow_slice =
611-
STDEXEC::__any::__nothrow_slice<__interface_type, _Base, __buffer_size>;
613+
STDEXEC::__any::__nothrow_slice<__this_interface_type, _Base, __buffer_size>;
612614

613615
//! @pre !empty(*this)
614616
constexpr virtual void
615617
__slice_to_(__value_proxy_root<_Interface> &__out) noexcept(__nothrow_slice) {
616618
STDEXEC_ASSERT(!__empty(*this));
617619
if constexpr (_Base::__box_kind != __box_kind::__abstract) {
618620
using __root_interface_t = _Base::__interface_type;
619-
constexpr bool __is_root_interface = std::same_as<__root_interface_t, __interface_type>;
621+
constexpr bool __is_root_interface =
622+
std::same_as<__root_interface_t, __this_interface_type>;
620623
STDEXEC_ASSERT(!__is_root_interface);
621624
if constexpr (!__is_root_interface) {
622625
if constexpr (_Base::__box_kind == __box_kind::__proxy) {
@@ -893,7 +896,7 @@ namespace STDEXEC::__any {
893896
struct __reference_union {
894897
union {
895898
_Value *__value_ptr_ = nullptr;
896-
__iroot *__root_ptr_; // points to a __value_root<_Extension, __value_type>
899+
__iroot *__root_ptr_; // points to a __value_root<_Extension, _Value>
897900
};
898901
bool __which_ = false; // true if root, false if value
899902
};

include/stdexec/__detail/__utility.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -259,21 +259,21 @@ namespace STDEXEC {
259259

260260
//////////////////////////////////////////////////////////////////////////////////////////
261261
// __polymorphic_downcast
262-
template <class ResultPtr, class CvInterface>
262+
template <class _ResultPtr, class _CvInterface>
263263
[[nodiscard]]
264-
inline constexpr auto* __polymorphic_downcast(CvInterface* from) noexcept {
265-
static_assert(std::is_pointer_v<ResultPtr>);
266-
using value_type = __copy_cvref_t<CvInterface, std::remove_pointer_t<ResultPtr>>;
264+
inline constexpr auto* __polymorphic_downcast(_CvInterface* __from_ptr) noexcept {
265+
static_assert(std::is_pointer_v<_ResultPtr>);
266+
using __value_type = __copy_cvref_t<_CvInterface, std::remove_pointer_t<_ResultPtr>>;
267267
static_assert(
268-
std::derived_from<value_type, CvInterface>,
268+
std::derived_from<__value_type, _CvInterface>,
269269
"__polymorphic_downcast requires From to be a base class of To");
270270

271271
#if defined(__cpp_rtti) && __cpp_rtti >= 1997'11L
272272
STDEXEC_IF_NOT_CONSTEVAL {
273-
STDEXEC_ASSERT(dynamic_cast<value_type*>(from) != nullptr);
273+
STDEXEC_ASSERT(dynamic_cast<__value_type*>(__from_ptr) != nullptr);
274274
}
275275
#endif
276-
return static_cast<value_type*>(from);
276+
return static_cast<__value_type*>(__from_ptr);
277277
}
278278

279279
namespace __std {
@@ -284,14 +284,14 @@ namespace STDEXEC {
284284
#else
285285
template <class _Ty>
286286
STDEXEC_ATTRIBUTE(nodiscard, always_inline)
287-
_Ty* start_lifetime_as(void* p) noexcept {
288-
return std::launder(static_cast<_Ty*>(p));
287+
_Ty* start_lifetime_as(void* __ptr) noexcept {
288+
return std::launder(static_cast<_Ty*>(__ptr));
289289
}
290290

291291
template <class _Ty>
292292
STDEXEC_ATTRIBUTE(nodiscard, always_inline)
293-
_Ty const * start_lifetime_as(void const * p) noexcept {
294-
return std::launder(static_cast<_Ty const *>(p));
293+
_Ty const * start_lifetime_as(void const * __ptr) noexcept {
294+
return std::launder(static_cast<_Ty const *>(__ptr));
295295
}
296296
#endif
297297

test/stdexec/detail/test_any.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ struct foobar {
9090
State state;
9191
};
9292

93-
static_assert(std::derived_from<any::__iabstract<any::__icopyable>, any::__iabstract<any::__imovable>>);
93+
static_assert(
94+
std::derived_from<any::__iabstract<any::__icopyable>, any::__iabstract<any::__imovable>>);
9495
static_assert(std::derived_from<any::__iabstract<ibar>, any::__iabstract<ifoo>>);
9596
static_assert(!std::derived_from<any::__iabstract<ibar>, any::__iabstract<any::__icopyable>>);
9697
static_assert(any::__extension_of<any::__iabstract<ibar>, any::__icopyable>);
@@ -117,7 +118,7 @@ struct IBar : any::interface<IBar, Base, any::__extends<any::__icopyable>> {
117118
template <class Base>
118119
struct IBaz
119120
: any::interface<IBaz, Base, any::__extends<IFoo, IBar>> // inherits twice
120-
// from __icopyable
121+
// from __icopyable
121122
{
122123
using IBaz::interface::interface;
123124

@@ -162,8 +163,8 @@ consteval void test_consteval() {
162163
auto y = any::__any_cast<foobar<T>>(pifoo);
163164
}
164165

165-
TEMPLATE_TEST_CASE("basic usage", "[any]", foobar<Small>, foobar<Big>) {
166-
#if ANY_COMPILER_CLANG || ANY_COMPILER_GCC >= 14'03
166+
TEMPLATE_TEST_CASE("basic usage of any::__any", "[detail][any]", foobar<Small>, foobar<Big>) {
167+
#if STDEXEC_CLANG() || (STDEXEC_GCC() && STDEXEC_GCC_VERSION >= 14'03)
167168
test_consteval<TestType>(); // NOLINT(invalid_consteval_call)
168169
#endif
169170

0 commit comments

Comments
 (0)