mirror of
https://github.com/gcc-mirror/gcc.git
synced 2025-07-21 23:52:54 +00:00

The following patch makes std::exception_ptr_cast constexpr. The paper suggests using dynamic_cast, but that does only work for polymorphic exceptions, doesn't work if they are scalar or non-polymorphic classes. Furthermore, the patch adds some static_asserts for "Mandates: E is a cv-unqualified complete object type. E is not an array type. E is not a pointer or pointer-to-member type." 2025-07-11 Jakub Jelinek <jakub@redhat.com> * libsupc++/exception_ptr.h: Implement C++26 P3748R0 - Inspecting exception_ptr should be constexpr. (std::exception_ptr_cast): Make constexpr, remove inline keyword. Add static_asserts for Mandates. For if consteval use std::rethrow_exception, catch it and return its address or nullptr. * testsuite/18_support/exception_ptr/exception_ptr_cast.cc (E::~E): Add constexpr. (G::G): Likewise. (test01): Likewise. Return bool and take bool argument, throw if the argument is true. Add static_assert(test01(false)). (main): Call test01(true) in try.
file: libstdc++-v3/README New users may wish to point their web browsers to the file index.html in the 'doc/html' subdirectory. It contains brief building instructions and notes on how to configure the library in interesting ways.