diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-04-30 09:48:00 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2024-05-14 10:50:19 +0100 |
commit | 4d3b358fd757ddd09cbee202f47939043c78676c (patch) | |
tree | 824c8935515274921e7588706e1c0fa785a225fd | |
parent | 788ccd269e0c32c33ce0c1359137fe1b35dc7a2d (diff) | |
download | gcc-4d3b358fd757ddd09cbee202f47939043c78676c.zip gcc-4d3b358fd757ddd09cbee202f47939043c78676c.tar.gz gcc-4d3b358fd757ddd09cbee202f47939043c78676c.tar.bz2 |
libstdc++: Guard uses of is_pointer_interconvertible_v [PR114891]
This type trait isn't supported by Clang 18. It's only used in static
assertions, so they can just be omitted if the trait isn't available.
libstdc++-v3/ChangeLog:
PR libstdc++/114891
* include/std/generator: Check feature test macro before using
is_pointer_interconvertible_v.
(cherry picked from commit 1fbe1a50d86df11f434351cf62461a32747f9710)
-rw-r--r-- | libstdc++-v3/include/std/generator | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/generator b/libstdc++-v3/include/std/generator index 789016b..1d5acc9 100644 --- a/libstdc++-v3/include/std/generator +++ b/libstdc++-v3/include/std/generator @@ -322,8 +322,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Promise> auto await_suspend(std::coroutine_handle<_Promise> __c) noexcept { +#ifdef __glibcxx_is_pointer_interconvertible static_assert(is_pointer_interconvertible_base_of_v< _Promise_erased, _Promise>); +#endif auto& __n = __c.promise()._M_nest; return __n._M_pop(); @@ -344,8 +346,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Promise> void await_suspend(std::coroutine_handle<_Promise>) noexcept { +#ifdef __glibcxx_is_pointer_interconvertible static_assert(is_pointer_interconvertible_base_of_v< _Promise_erased, _Promise>); +#endif _M_bottom_value = ::std::addressof(_M_value); } @@ -375,8 +379,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::coroutine_handle<> await_suspend(std::coroutine_handle<_Promise> __p) noexcept { +#ifdef __glibcxx_is_pointer_interconvertible static_assert(is_pointer_interconvertible_base_of_v< _Promise_erased, _Promise>); +#endif auto __c = _Coro_handle::from_address(__p.address()); auto __t = _Coro_handle::from_address(this->_M_gen._M_coro.address()); @@ -685,8 +691,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return { coroutine_handle<promise_type>::from_promise(*this) }; } }; +#ifdef __glibcxx_is_pointer_interconvertible static_assert(is_pointer_interconvertible_base_of_v<_Erased_promise, promise_type>); +#endif generator(const generator&) = delete; |