Skip to content

Commit b6f1743

Browse files
committed
P2927R3 Inspecting exception_ptr
1 parent d81264a commit b6f1743

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

source/support.tex

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@
652652
#define @\defnlibxname{cpp_lib_erase_if}@ 202002L
653653
// also in \libheader{string}, \libheader{deque}, \libheader{forward_list}, \libheader{list}, \libheader{vector}, \libheader{map}, \libheader{set}, \libheader{unordered_map},
654654
// \libheader{unordered_set}
655+
#define @\defnlibxname{cpp_lib_exception_ptr_cast}@ 202506L // also in \libheader{exception}
655656
#define @\defnlibxname{cpp_lib_exchange_function}@ 201304L // freestanding, also in \libheader{utility}
656657
#define @\defnlibxname{cpp_lib_execution}@ 201902L // also in \libheader{execution}
657658
#define @\defnlibxname{cpp_lib_expected}@ 202211L // also in \libheader{expected}
@@ -3868,6 +3869,8 @@
38683869
constexpr exception_ptr current_exception() noexcept;
38693870
[[noreturn]] constexpr void rethrow_exception(exception_ptr p);
38703871
template<class E> constexpr exception_ptr make_exception_ptr(E e) noexcept;
3872+
template<class E> const E* exception_ptr_cast(const exception_ptr& p) noexcept;
3873+
template<class E> void exception_ptr_cast(const exception_ptr&&) = delete;
38713874

38723875
template<class T> [[noreturn]] constexpr void throw_with_nested(T&& t);
38733876
template<class E> constexpr void rethrow_if_nested(const E& e);
@@ -4147,7 +4150,8 @@
41474150
For purposes of determining the presence of a data race, operations on
41484151
\tcode{exception_ptr} objects shall access and modify only the
41494152
\tcode{exception_ptr} objects themselves and not the exceptions they refer to.
4150-
Use of \tcode{rethrow_exception} on \tcode{exception_ptr} objects that refer to
4153+
Use of \tcode{rethrow_exception} or \tcode{exception_ptr_cast}
4154+
on \tcode{exception_ptr} objects that refer to
41514155
the same exception object shall not introduce a data race.
41524156
\begin{note}
41534157
If
@@ -4244,6 +4248,32 @@
42444248
\end{note}
42454249
\end{itemdescr}
42464250

4251+
\indexlibraryglobal{exception_ptr_cast}%
4252+
\begin{itemdecl}
4253+
template<class E> const E* exception_ptr_cast(const exception_ptr& p) noexcept;
4254+
\end{itemdecl}
4255+
4256+
\begin{itemdescr}
4257+
\pnum
4258+
\mandates
4259+
\tcode{E} is a cv-unqualified complete object type.
4260+
\tcode{E} is not an array type.
4261+
\tcode{E} is not a pointer or pointer-to-member type.
4262+
\begin{note}
4263+
When \tcode{E} is a pointer or pointer-to-member type,
4264+
a handler of type \tcode{const E\&} can match
4265+
without binding to the exception object itself.
4266+
\end{note}
4267+
4268+
\pnum
4269+
\returns
4270+
A pointer to the exception object referred to by \tcode{p},
4271+
if \tcode{p} is not null and
4272+
a handler of type \tcode{const E\&}
4273+
would be a match\iref{except.handle} for that exception object.
4274+
Otherwise, \tcode{nullptr}.
4275+
\end{itemdescr}
4276+
42474277
\rSec2[except.nested]{\tcode{nested_exception}}
42484278

42494279
\indexlibraryglobal{nested_exception}%

0 commit comments

Comments
 (0)