Skip to content

Commit d194462

Browse files
authored
Implement non-concepts fallback for coroutine_handle operator<=> (#1249)
* Implement non-concepts fallback for coroutine_handle operator<=> ... to allow EDG to compile `<coroutine>`. [This is a dual of MSVC-PR-271029.] * Reorder feature-tests in `<experimental/generator>` ... so it won't notice that Edge defines both `__cpp_impl_coroutine` and `__cpp_coroutines` in C++20 mode. Also don't test `VSO_0971246_legacy_await_headers` with `/BE /await`; `/await` is meaningless for Edge.
1 parent e652e72 commit d194462

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

stl/inc/coroutine

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ _NODISCARD constexpr bool operator==(const coroutine_handle<> _Left, const corou
126126

127127
_NODISCARD constexpr strong_ordering operator<=>(
128128
const coroutine_handle<> _Left, const coroutine_handle<> _Right) noexcept {
129-
return compare_three_way()(_Left.address(), _Right.address());
129+
#ifdef __cpp_lib_concepts
130+
return compare_three_way{}(_Left.address(), _Right.address());
131+
#else // ^^^ no workaround / workaround vvv
132+
return _Left.address() <=> _Right.address();
133+
#endif // __cpp_lib_concepts
130134
}
131135

132136
template <class _Promise>

stl/inc/experimental/generator

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
#include <yvals_core.h>
1010
#if _STL_COMPILER_PREPROCESSOR
1111

12-
#if !defined(__cpp_coroutines) && !defined(__cpp_impl_coroutine)
13-
#error <experimental/generator> requires /std:c++latest or /await compiler options
14-
#endif // !defined(__cpp_coroutines) && !defined(__cpp_impl_coroutine)
15-
1612
#ifdef _CPPUNWIND
1713
#include <exception>
1814
#endif
1915
#include <memory>
20-
#ifdef __cpp_coroutines
21-
#include <experimental/resumable>
22-
#else // __cpp_coroutines
16+
17+
#if defined(__cpp_impl_coroutine)
2318
#include <coroutine>
24-
#endif // __cpp_coroutines
19+
#elif defined(__cpp_coroutines)
20+
#include <experimental/resumable>
21+
#else // ^^^ legacy coroutines / no coroutine support vvv
22+
#error <experimental/generator> requires /std:c++latest or /await compiler options
23+
#endif // ^^^ no coroutine support ^^^
24+
2525

2626
#pragma pack(push, _CRT_PACKING)
2727
#pragma warning(push, _STL_WARNING_LEVEL)

tests/std/tests/VSO_0971246_legacy_await_headers/env.lst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ PM_CL="/EHsc /MT /std:c++latest /permissive-"
77
PM_CL="/EHsc /MT /std:c++latest /permissive"
88
PM_CL="/EHsc /MT /std:c++latest /permissive- /await"
99
PM_CL="/EHsc /MT /std:c++latest /permissive /await"
10-
PM_CL="/BE /c /EHsc /MD /std:c++latest /permissive- /await"
1110
PM_CL="/BE /c /EHsc /MD /std:c++latest /permissive-"

0 commit comments

Comments
 (0)