Skip to content
Snippets Groups Projects
Unverified Commit 1fbe1a50 authored by Jonathan Wakely's avatar Jonathan Wakely
Browse files

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.
parent c3bc2787
No related branches found
No related tags found
No related merge requests found
...@@ -322,8 +322,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -322,8 +322,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Promise> template<typename _Promise>
auto await_suspend(std::coroutine_handle<_Promise> __c) noexcept auto await_suspend(std::coroutine_handle<_Promise> __c) noexcept
{ {
#ifdef __glibcxx_is_pointer_interconvertible
static_assert(is_pointer_interconvertible_base_of_v< static_assert(is_pointer_interconvertible_base_of_v<
_Promise_erased, _Promise>); _Promise_erased, _Promise>);
#endif
auto& __n = __c.promise()._M_nest; auto& __n = __c.promise()._M_nest;
return __n._M_pop(); return __n._M_pop();
...@@ -344,8 +346,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -344,8 +346,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Promise> template<typename _Promise>
void await_suspend(std::coroutine_handle<_Promise>) noexcept void await_suspend(std::coroutine_handle<_Promise>) noexcept
{ {
#ifdef __glibcxx_is_pointer_interconvertible
static_assert(is_pointer_interconvertible_base_of_v< static_assert(is_pointer_interconvertible_base_of_v<
_Promise_erased, _Promise>); _Promise_erased, _Promise>);
#endif
_M_bottom_value = ::std::addressof(_M_value); _M_bottom_value = ::std::addressof(_M_value);
} }
...@@ -375,8 +379,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -375,8 +379,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::coroutine_handle<> std::coroutine_handle<>
await_suspend(std::coroutine_handle<_Promise> __p) noexcept await_suspend(std::coroutine_handle<_Promise> __p) noexcept
{ {
#ifdef __glibcxx_is_pointer_interconvertible
static_assert(is_pointer_interconvertible_base_of_v< static_assert(is_pointer_interconvertible_base_of_v<
_Promise_erased, _Promise>); _Promise_erased, _Promise>);
#endif
auto __c = _Coro_handle::from_address(__p.address()); auto __c = _Coro_handle::from_address(__p.address());
auto __t = _Coro_handle::from_address(this->_M_gen._M_coro.address()); auto __t = _Coro_handle::from_address(this->_M_gen._M_coro.address());
...@@ -685,8 +691,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -685,8 +691,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return { coroutine_handle<promise_type>::from_promise(*this) }; } { return { coroutine_handle<promise_type>::from_promise(*this) }; }
}; };
#ifdef __glibcxx_is_pointer_interconvertible
static_assert(is_pointer_interconvertible_base_of_v<_Erased_promise, static_assert(is_pointer_interconvertible_base_of_v<_Erased_promise,
promise_type>); promise_type>);
#endif
generator(const generator&) = delete; generator(const generator&) = delete;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment