30 #ifndef _GLIBCXX_NESTED_EXCEPTION_H
31 #define _GLIBCXX_NESTED_EXCEPTION_H 1
33 #pragma GCC visibility push(default)
35 #if __cplusplus < 201103L
42 #if !(defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP))
43 #if ATOMIC_INT_LOCK_FREE < 2
44 # error This platform does not support exception propagation.
73 rethrow_nested()
const
81 nested_ptr()
const noexcept
85 template<
typename _Except>
88 explicit _Nested_exception(
const _Except& __ex)
92 explicit _Nested_exception(_Except&& __ex)
93 : _Except(static_cast<_Except&&>(__ex))
100 template<
typename _Tp>
102 __throw_with_nested_impl(_Tp&& __t,
true_type)
104 using _Up =
typename remove_reference<_Tp>::type;
105 throw _Nested_exception<_Up>{std::forward<_Tp>(__t)};
108 template<
typename _Tp>
110 __throw_with_nested_impl(_Tp&& __t,
false_type)
111 {
throw std::forward<_Tp>(__t); }
115 template<
typename _Tp>
120 using _Up =
typename decay<_Tp>::type;
121 using _CopyConstructible
122 = __and_<is_copy_constructible<_Up>, is_move_constructible<_Up>>;
123 static_assert(_CopyConstructible::value,
124 "throw_with_nested argument must be CopyConstructible");
126 __not_<is_base_of<nested_exception, _Up>>>;
127 std::__throw_with_nested_impl(std::forward<_Tp>(__t), __nest{});
131 template<
typename _Tp>
132 using __rethrow_if_nested_cond =
typename enable_if<
133 __and_<is_polymorphic<_Tp>,
134 __or_<__not_<is_base_of<nested_exception, _Tp>>,
135 is_convertible<_Tp*, nested_exception*>>>::value
139 template<
typename _Ex>
140 inline __rethrow_if_nested_cond<_Ex>
141 __rethrow_if_nested_impl(
const _Ex* __ptr)
143 if (
auto __ne_ptr = dynamic_cast<const nested_exception*>(__ptr))
144 __ne_ptr->rethrow_nested();
149 __rethrow_if_nested_impl(
const void*)
153 template<
typename _Ex>
165 #pragma GCC visibility pop
167 #endif // _GLIBCXX_NESTED_EXCEPTION_H
exception_ptr current_exception() noexcept
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
Exception class with exception_ptr data member.
void throw_with_nested(_Tp &&__t)
If __t is derived from nested_exception, throws __t. Else, throws an implementation-defined object de...
void rethrow_if_nested(const _Ex &__ex)
If __ex is derived from nested_exception, __ex.rethrow_nested().
_Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
void rethrow_exception(exception_ptr) __attribute__((__noreturn__))
Throw the object pointed to by the exception_ptr.
ISO C++ entities toplevel namespace is std.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
void terminate() noexcept __attribute__((__noreturn__))