31#ifndef _EXCEPTION_PTR_H
32#define _EXCEPTION_PTR_H
40#if __cplusplus >= 201103L
44#ifdef _GLIBCXX_EH_PTR_RELOPS_COMPAT
45# define _GLIBCXX_EH_PTR_USED __attribute__((__used__))
47# define _GLIBCXX_EH_PTR_USED
61 namespace __exception_ptr
66 using __exception_ptr::exception_ptr;
77 template<typename _Ex>
79 _GLIBCXX_USE_NOEXCEPT;
84#if __cpp_lib_exception_ptr_cast >= 202506L
85 template<
typename _Ex>
86 constexpr const _Ex* exception_ptr_cast(
const exception_ptr&)
noexcept;
87 template<
typename _Ex>
91 namespace __exception_ptr
109#if __cplusplus >= 202400L
110 [[__gnu__::__gnu_inline__]]
116#if __cpp_if_consteval >= 202106L \
117 && _GLIBCXX_HAS_BUILTIN(__builtin_eh_ptr_adjust_ref)
133 void *
_M_get() const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__));
137 template<typename _Ex>
139 _GLIBCXX_USE_NOEXCEPT;
140#if __cpp_lib_exception_ptr_cast >= 202506L
141 template<
typename _Ex>
142 friend constexpr const _Ex*
147 _GLIBCXX_USE_NOEXCEPT;
153 _GLIBCXX_USE_NOEXCEPT;
155#if __cplusplus >= 201103L
162 { __o._M_exception_object =
nullptr; }
165#if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT)
175#if __cplusplus >= 201103L
189#ifdef _GLIBCXX_EH_PTR_COMPAT
191 void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT;
192 bool operator!() const _GLIBCXX_USE_NOEXCEPT
193 __attribute__ ((__pure__));
194 operator __safe_bool() const _GLIBCXX_USE_NOEXCEPT;
197#if __cplusplus >= 201103L
202#if __cpp_impl_three_way_comparison >= 201907L \
203 && ! defined _GLIBCXX_EH_PTR_RELOPS_COMPAT
209 _GLIBCXX_USE_NOEXCEPT
210 {
return __x._M_exception_object == __y._M_exception_object; }
214 _GLIBCXX_USE_NOEXCEPT
215 {
return __x._M_exception_object != __y._M_exception_object; }
224 __attribute__ ((__pure__));
236 _GLIBCXX_USE_NOEXCEPT
241#if __cpp_if_consteval >= 202106L \
242 && _GLIBCXX_HAS_BUILTIN(__builtin_eh_ptr_adjust_ref)
258#if __cpp_if_consteval >= 202106L \
259 && _GLIBCXX_HAS_BUILTIN(__builtin_eh_ptr_adjust_ref)
283 __other._M_exception_object = __tmp;
289 { __lhs.
swap(__rhs); }
292 template<
typename _Ex>
295 __dest_thunk(
void* __x)
296 {
static_cast<_Ex*
>(__x)->~_Ex(); }
301 using __exception_ptr::swap;
304 template<
typename _Ex>
305#if !(__cplusplus >= 201103L && __cpp_rtti) && !__cpp_exceptions
308 __attribute__ ((__always_inline__))
inline
313#if __cplusplus >= 201103L && __cpp_rtti
316#ifdef __glibcxx_constexpr_exceptions
324 __exception_ptr::__dest_thunk<_Ex2>);
327 ::new (__e) _Ex2(__ex);
338#ifdef __cpp_exceptions
351#if __cpp_lib_exception_ptr_cast >= 202506L
352 template<
typename _Ex>
353 [[__gnu__::__always_inline__]]
357 static_assert(!std::is_const_v<_Ex>);
358 static_assert(!std::is_reference_v<_Ex>);
359 static_assert(std::is_object_v<_Ex>);
360 static_assert(!std::is_array_v<_Ex>);
361 static_assert(!std::is_pointer_v<_Ex>);
362 static_assert(!std::is_member_pointer_v<_Ex>);
367 const type_info &__id =
typeid(
const _Ex&);
368 return static_cast<const _Ex*
>(__p._M_exception_ptr_cast(__id));
372#ifdef __cpp_exceptions
373 if (__p._M_exception_object)
378 catch (
const _Ex& __exc)
391#undef _GLIBCXX_EH_PTR_USED
#define _GLIBCXX_CDTOR_CALLABI
#define _GLIBCXX_EH_PTR_USED
#define _GLIBCXX_VISIBILITY(V)
#define _GLIBCXX26_CONSTEXPR
typename __decay_selector< _Tp >::type type
exception_ptr current_exception() noexcept
exception_ptr make_exception_ptr(_Ex) noexcept
Obtain an exception_ptr pointing to a copy of the supplied object.
void rethrow_exception(exception_ptr)
Throw the object pointed to by the exception_ptr.
decltype(nullptr) nullptr_t
bool operator!=(const fpos< _StateT > &__lhs, const fpos< _StateT > &__rhs)
ISO C++ entities toplevel namespace is std.
__cxa_refcounted_exception * __cxa_init_primary_exception(void *__object, std::type_info *__tinfo, void(*__dest)(void *)) noexcept
void * __cxa_allocate_exception(size_t) noexcept
void __cxa_free_exception(void *) noexcept
void _M_release() noexcept
friend void std::rethrow_exception(exception_ptr)
void * _M_exception_object
exception_ptr(void *__e) noexcept
const void * _M_exception_ptr_cast(const type_info &) const noexcept
friend exception_ptr std::current_exception() noexcept
exception_ptr & operator=(exception_ptr &&__o) noexcept
void swap(exception_ptr &) noexcept
exception_ptr(nullptr_t) noexcept
friend bool operator==(const exception_ptr &, const exception_ptr &) noexcept=default
void swap(exception_ptr &__lhs, exception_ptr &__rhs)
void _M_addref() noexcept
friend exception_ptr std::make_exception_ptr(_Ex) noexcept
const class std::type_info * __cxa_exception_type() const noexcept
exception_ptr(exception_ptr &&__o) noexcept
void * _M_get() const noexcept
An opaque pointer to an arbitrary exception.
void swap(exception_ptr &) noexcept
~exception_ptr() noexcept
exception_ptr & operator=(const exception_ptr &) noexcept
An opaque pointer to an arbitrary exception.