aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog119
-rw-r--r--libstdc++-v3/include/bits/cpp_type_traits.h26
-rw-r--r--libstdc++-v3/include/bits/iterator_concepts.h34
-rw-r--r--libstdc++-v3/include/bits/max_size_type.h48
-rw-r--r--libstdc++-v3/include/bits/ranges_base.h15
-rw-r--r--libstdc++-v3/include/bits/stl_algobase.h9
-rw-r--r--libstdc++-v3/include/bits/version.def9
-rw-r--r--libstdc++-v3/include/bits/version.h10
-rw-r--r--libstdc++-v3/include/ext/numeric_traits.h6
-rw-r--r--libstdc++-v3/include/std/charconv4
-rw-r--r--libstdc++-v3/include/std/format14
-rw-r--r--libstdc++-v3/include/std/limits3
-rw-r--r--libstdc++-v3/include/std/type_traits27
-rw-r--r--libstdc++-v3/libsupc++/exception11
-rw-r--r--libstdc++-v3/libsupc++/exception.h19
-rw-r--r--libstdc++-v3/libsupc++/exception_ptr.h128
-rw-r--r--libstdc++-v3/libsupc++/nested_exception.h19
-rw-r--r--libstdc++-v3/libsupc++/new26
-rw-r--r--libstdc++-v3/libsupc++/typeinfo22
-rw-r--r--libstdc++-v3/testsuite/18_support/exception_ptr/exception_ptr_cast.cc19
20 files changed, 411 insertions, 157 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 8abb719..716a516 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,122 @@
+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.
+
+2025-07-11 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/cpp_type_traits.h (__is_floating<__float128>):
+ Do not depend on __STRICT_ANSI__.
+ * include/bits/stl_algobase.h (__size_to_integer(__float128)):
+ Likewise.
+ * include/std/type_traits (__is_floating_point_helper<__float128>):
+ Likewise.
+
+2025-07-11 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/96710
+ * include/bits/cpp_type_traits.h (__is_integer): Define explicit
+ specializations for __int128.
+ (__memcpyable_integer): Remove explicit specializations for
+ __int128.
+ * include/bits/iterator_concepts.h (incrementable_traits):
+ Likewise.
+ (__is_signed_int128, __is_unsigned_int128, __is_int128): Remove.
+ (__is_integer_like, __is_signed_integer_like): Remove check for
+ __int128.
+ * include/bits/max_size_type.h: Remove all uses of __is_int128
+ in constraints.
+ * include/bits/ranges_base.h (__to_unsigned_like): Remove
+ overloads for __int128.
+ (ranges::ssize): Remove special case for __int128.
+ * include/bits/stl_algobase.h (__size_to_integer): Define
+ __int128 overloads for strict modes.
+ * include/ext/numeric_traits.h (__is_integer_nonstrict): Remove
+ explicit specializations for __int128.
+ * include/std/charconv (to_chars): Define overloads for
+ __int128.
+ * include/std/format (__format::make_unsigned_t): Remove.
+ (__format::to_chars): Remove.
+ * include/std/limits (numeric_limits): Define explicit
+ specializations for __int128.
+ * include/std/type_traits (__is_integral_helper): Likewise.
+ (__make_unsigned, __make_signed): Likewise.
+
+2025-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/117785
+ * include/bits/version.def (constexpr_exceptions): New.
+ * include/bits/version.h: Regenerate.
+ * libsupc++/exception (std::bad_exception::bad_exception): Add
+ _GLIBCXX26_CONSTEXPR.
+ (std::bad_exception::~bad_exception, std::bad_exception::what): For
+ C++26 add constexpr and define inline.
+ * libsupc++/exception.h (std::exception::exception,
+ std::exception::operator=): Add _GLIBCXX26_CONSTEXPR.
+ (std::exception::~exception, std::exception::what): For C++26 add
+ constexpr and define inline.
+ * libsupc++/exception_ptr.h (std::make_exception_ptr): Add
+ _GLIBCXX26_CONSTEXPR. For if consteval use just throw with
+ current_exception() in catch.
+ (std::exception_ptr::exception_ptr(void*)): For C++26 add constexpr
+ and define inline.
+ (std::exception_ptr::exception_ptr()): Add _GLIBCXX26_CONSTEXPR.
+ (std::exception_ptr::exception_ptr(const exception_ptr&)): Likewise.
+ Use __builtin_eh_ptr_adjust_ref if consteval and compiler has it
+ instead of _M_addref.
+ (std::exception_ptr::exception_ptr(nullptr_t)): Add
+ _GLIBCXX26_CONSTEXPR.
+ (std::exception_ptr::exception_ptr(exception_ptr&&)): Likewise.
+ (std::exception_ptr::operator=): Likewise.
+ (std::exception_ptr::~exception_ptr): Likewise. Use
+ __builtin_eh_ptr_adjust_ref if consteval and compiler has it
+ instead of _M_release.
+ (std::exception_ptr::swap): Add _GLIBCXX26_CONSTEXPR.
+ (std::exception_ptr::operator bool): Likewise.
+ (std::exception_ptr::operator==): Likewise.
+ * libsupc++/nested_exception.h
+ (std::nested_exception::nested_exception): Add _GLIBCXX26_CONSTEXPR.
+ (std::nested_exception::operator=): Likewise.
+ (std::nested_exception::~nested_exception): For C++26 add constexpr
+ and define inline.
+ (std::nested_exception::rethrow_if_nested): Add _GLIBCXX26_CONSTEXPR.
+ (std::nested_exception::nested_ptr): Likewise.
+ (std::_Nested_exception::_Nested_exception): Likewise.
+ (std::throw_with_nested, std::rethrow_if_nested): Likewise.
+ * libsupc++/new (std::bad_alloc::bad_alloc): Likewise.
+ (std::bad_alloc::operator=): Likewise.
+ (std::bad_alloc::~bad_alloc): For C++26 add constexpr and define
+ inline.
+ (std::bad_alloc::what): Likewise.
+ (std::bad_array_new_length::bad_array_new_length): Add
+ _GLIBCXX26_CONSTEXPR.
+ (std::bad_array_new_length::~bad_array_new_length): For C++26 add
+ constexpr and define inline.
+ (std::bad_array_new_length::what): Likewise.
+ * libsupc++/typeinfo (std::bad_cast::bad_cast): Add
+ _GLIBCXX26_CONSTEXPR.
+ (std::bad_cast::~bad_cast): For C++26 add constexpr and define inline.
+ (std::bad_cast::what): Likewise.
+ (std::bad_typeid::bad_typeid): Add _GLIBCXX26_CONSTEXPR.
+ (std::bad_typeid::~bad_typeid): For C++26 add constexpr and define
+ inline.
+ (std::bad_typeid::what): Likewise.
+
+2025-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/22_locale/codecvt/codecvt_unicode.h
+ (ucs2_to_utf8_out_error): Comment spelling fix: bellow -> below.
+ (utf16_to_ucs2_in_error): Likewise.
+
2025-07-09 Jonathan Wakely <jwakely@redhat.com>
* include/bits/stl_uninitialized.h (__uninitialized_default):
diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h
index b1a6206..38cea4c 100644
--- a/libstdc++-v3/include/bits/cpp_type_traits.h
+++ b/libstdc++-v3/include/bits/cpp_type_traits.h
@@ -273,6 +273,12 @@ __INT_N(__GLIBCXX_TYPE_INT_N_2)
__INT_N(__GLIBCXX_TYPE_INT_N_3)
#endif
+#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__
+// In strict modes __GLIBCXX_TYPE_INT_N_0 is not defined for __int128,
+// but we want to always treat signed/unsigned __int128 as integral types.
+__INT_N(__int128)
+#endif
+
#undef __INT_N
//
@@ -307,6 +313,15 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3)
typedef __true_type __type;
};
+#ifdef _GLIBCXX_USE_FLOAT128
+ template<>
+ struct __is_floating<__float128>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+#endif
+
#ifdef __STDCPP_FLOAT16_T__
template<>
struct __is_floating<_Float16>
@@ -545,17 +560,6 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3)
{ enum { __width = __GLIBCXX_BITSIZE_INT_N_3 }; };
#endif
-#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__
- // In strict modes __is_integer<__int128> is false,
- // but we want to allow memcpy between signed/unsigned __int128.
- __extension__
- template<>
- struct __memcpyable_integer<__int128> { enum { __width = 128 }; };
- __extension__
- template<>
- struct __memcpyable_integer<unsigned __int128> { enum { __width = 128 }; };
-#endif
-
#if _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 && _GLIBCXX_LDOUBLE_IS_IEEE_BINARY64
template<>
struct __memcpyable<double*, long double*> { enum { __value = true }; };
diff --git a/libstdc++-v3/include/bits/iterator_concepts.h b/libstdc++-v3/include/bits/iterator_concepts.h
index d31e4f1..979039e 100644
--- a/libstdc++-v3/include/bits/iterator_concepts.h
+++ b/libstdc++-v3/include/bits/iterator_concepts.h
@@ -214,17 +214,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
= make_signed_t<decltype(std::declval<_Tp>() - std::declval<_Tp>())>;
};
-#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__
- // __int128 is incrementable even if !integral<__int128>
- template<>
- struct incrementable_traits<__int128>
- { using difference_type = __int128; };
-
- template<>
- struct incrementable_traits<unsigned __int128>
- { using difference_type = __int128; };
-#endif
-
namespace __detail
{
// An iterator such that iterator_traits<_Iter> names a specialization
@@ -611,24 +600,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __max_diff_type;
class __max_size_type;
- __extension__
- template<typename _Tp>
- concept __is_signed_int128
-#if __SIZEOF_INT128__
- = same_as<_Tp, __int128>;
-#else
- = false;
-#endif
-
- __extension__
- template<typename _Tp>
- concept __is_unsigned_int128
-#if __SIZEOF_INT128__
- = same_as<_Tp, unsigned __int128>;
-#else
- = false;
-#endif
-
template<typename _Tp>
concept __cv_bool = same_as<const volatile _Tp, const volatile bool>;
@@ -636,16 +607,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
concept __integral_nonbool = integral<_Tp> && !__cv_bool<_Tp>;
template<typename _Tp>
- concept __is_int128 = __is_signed_int128<_Tp> || __is_unsigned_int128<_Tp>;
-
- template<typename _Tp>
concept __is_integer_like = __integral_nonbool<_Tp>
- || __is_int128<_Tp>
|| same_as<_Tp, __max_diff_type> || same_as<_Tp, __max_size_type>;
template<typename _Tp>
concept __is_signed_integer_like = signed_integral<_Tp>
- || __is_signed_int128<_Tp>
|| same_as<_Tp, __max_diff_type>;
} // namespace ranges::__detail
diff --git a/libstdc++-v3/include/bits/max_size_type.h b/libstdc++-v3/include/bits/max_size_type.h
index 30c5b12..a34b91a 100644
--- a/libstdc++-v3/include/bits/max_size_type.h
+++ b/libstdc++-v3/include/bits/max_size_type.h
@@ -65,7 +65,7 @@ namespace ranges
public:
__max_size_type() = default;
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
constexpr
__max_size_type(_Tp __i) noexcept
: _M_val(__i), _M_msb(__i < 0)
@@ -74,7 +74,7 @@ namespace ranges
constexpr explicit
__max_size_type(const __max_diff_type& __d) noexcept;
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
constexpr explicit
operator _Tp() const noexcept
{ return _M_val; }
@@ -260,52 +260,52 @@ namespace ranges
return *this;
}
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator+=(_Tp& __a, const __max_size_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a + __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator-=(_Tp& __a, const __max_size_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a - __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator*=(_Tp& __a, const __max_size_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a * __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator/=(_Tp& __a, const __max_size_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a / __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator%=(_Tp& __a, const __max_size_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a % __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator&=(_Tp& __a, const __max_size_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a & __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator|=(_Tp& __a, const __max_size_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a | __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator^=(_Tp& __a, const __max_size_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a ^ __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator<<=(_Tp& __a, const __max_size_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a << __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator>>=(_Tp& __a, const __max_size_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a >> __b)); }
@@ -447,7 +447,7 @@ namespace ranges
public:
__max_diff_type() = default;
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
constexpr
__max_diff_type(_Tp __i) noexcept
: _M_rep(__i)
@@ -458,7 +458,7 @@ namespace ranges
: _M_rep(__d)
{ }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
constexpr explicit
operator _Tp() const noexcept
{ return static_cast<_Tp>(_M_rep); }
@@ -591,52 +591,52 @@ namespace ranges
return *this;
}
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator+=(_Tp& __a, const __max_diff_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a + __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator-=(_Tp& __a, const __max_diff_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a - __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator*=(_Tp& __a, const __max_diff_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a * __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator/=(_Tp& __a, const __max_diff_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a / __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator%=(_Tp& __a, const __max_diff_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a % __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator&=(_Tp& __a, const __max_diff_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a & __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator|=(_Tp& __a, const __max_diff_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a | __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator^=(_Tp& __a, const __max_diff_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a ^ __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator<<=(_Tp& __a, const __max_diff_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a << __b)); }
- template<typename _Tp> requires integral<_Tp> || __is_int128<_Tp>
+ template<typename _Tp> requires integral<_Tp>
friend constexpr _Tp&
operator>>=(_Tp& __a, const __max_diff_type& __b) noexcept
{ return (__a = static_cast<_Tp>(__a >> __b)); }
diff --git a/libstdc++-v3/include/bits/ranges_base.h b/libstdc++-v3/include/bits/ranges_base.h
index c09f729..0251e5d 100644
--- a/libstdc++-v3/include/bits/ranges_base.h
+++ b/libstdc++-v3/include/bits/ranges_base.h
@@ -81,16 +81,6 @@ namespace ranges
__to_unsigned_like(_Tp __t) noexcept
{ return static_cast<make_unsigned_t<_Tp>>(__t); }
-#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__
- constexpr unsigned __int128
- __to_unsigned_like(__int128 __t) noexcept
- { return __t; }
-
- constexpr unsigned __int128
- __to_unsigned_like(unsigned __int128 __t) noexcept
- { return __t; }
-#endif
-
template<typename _Tp>
using __make_unsigned_like_t
= decltype(__detail::__to_unsigned_like(std::declval<_Tp>()));
@@ -398,11 +388,6 @@ namespace ranges
else
return static_cast<make_signed_t<__size_type>>(__size);
}
-#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__
- // For strict-ansi modes integral<__int128> is false
- else if constexpr (__detail::__is_int128<__size_type>)
- return static_cast<__int128>(__size);
-#endif
else // Must be one of __max_diff_type or __max_size_type.
return __detail::__max_diff_type(__size);
}
diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h
index 4d5662c..b104ec2 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -1052,13 +1052,20 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
__size_to_integer(unsigned __GLIBCXX_TYPE_INT_N_3 __n) { return __n; }
#endif
+#if defined(__STRICT_ANSI__) && defined(__SIZEOF_INT128__)
+ __extension__ inline _GLIBCXX_CONSTEXPR __int128
+ __size_to_integer(__int128 __n) { return __n; }
+ __extension__ inline _GLIBCXX_CONSTEXPR unsigned __int128
+ __size_to_integer(unsigned __int128 __n) { return __n; }
+#endif
+
inline _GLIBCXX_CONSTEXPR long long
__size_to_integer(float __n) { return (long long)__n; }
inline _GLIBCXX_CONSTEXPR long long
__size_to_integer(double __n) { return (long long)__n; }
inline _GLIBCXX_CONSTEXPR long long
__size_to_integer(long double __n) { return (long long)__n; }
-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
+#ifdef _GLIBCXX_USE_FLOAT128
__extension__ inline _GLIBCXX_CONSTEXPR long long
__size_to_integer(__float128 __n) { return (long long)__n; }
#endif
diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def
index 31385b5..df58e70 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -2050,6 +2050,15 @@ ftms = {
};
};
+ftms = {
+ name = constexpr_exceptions;
+ values = {
+ v = 202502;
+ cxxmin = 26;
+ extra_cond = "__cpp_constexpr_exceptions >= 202411L";
+ };
+};
+
// Standard test specifications.
stds[97] = ">= 199711L";
stds[03] = ">= 199711L";
diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h
index aa53f29..1414dd7 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -2299,4 +2299,14 @@
#endif /* !defined(__cpp_lib_bitset) && defined(__glibcxx_want_bitset) */
#undef __glibcxx_want_bitset
+#if !defined(__cpp_lib_constexpr_exceptions)
+# if (__cplusplus > 202302L) && (__cpp_constexpr_exceptions >= 202411L)
+# define __glibcxx_constexpr_exceptions 202502L
+# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_exceptions)
+# define __cpp_lib_constexpr_exceptions 202502L
+# endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_exceptions) && defined(__glibcxx_want_constexpr_exceptions) */
+#undef __glibcxx_want_constexpr_exceptions
+
#undef __glibcxx_want_all
diff --git a/libstdc++-v3/include/ext/numeric_traits.h b/libstdc++-v3/include/ext/numeric_traits.h
index 2cd8943..6786dc6 100644
--- a/libstdc++-v3/include/ext/numeric_traits.h
+++ b/libstdc++-v3/include/ext/numeric_traits.h
@@ -126,12 +126,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_INT_N_TRAITS(__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3)
#endif
-#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__
- // In strict modes __is_integer<__int128> is false,
- // but we still want to define __numeric_traits_integer<__int128>.
- _GLIBCXX_INT_N_TRAITS(__int128, 128)
-#endif
-
#undef _GLIBCXX_INT_N_TRAITS
#if __cplusplus >= 201103L
diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv
index dda49ce..8cf2c0b 100644
--- a/libstdc++-v3/include/std/charconv
+++ b/libstdc++-v3/include/std/charconv
@@ -390,6 +390,10 @@ _GLIBCXX_TO_CHARS(unsigned __GLIBCXX_TYPE_INT_N_2)
_GLIBCXX_TO_CHARS(signed __GLIBCXX_TYPE_INT_N_3)
_GLIBCXX_TO_CHARS(unsigned __GLIBCXX_TYPE_INT_N_3)
#endif
+#if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
+_GLIBCXX_TO_CHARS(signed __int128)
+_GLIBCXX_TO_CHARS(unsigned __int128)
+#endif
#undef _GLIBCXX_TO_CHARS
// _GLIBCXX_RESOLVE_LIB_DEFECTS
diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index d584b81..d63c6fc 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -1854,20 +1854,6 @@ namespace __format
__align, __nfill, __fill_char);
}
-#if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
- template<typename _Tp>
- using make_unsigned_t
- = typename __conditional_t<(sizeof(_Tp) <= sizeof(long long)),
- std::make_unsigned<_Tp>,
- type_identity<unsigned __int128>>::type;
-
- // std::to_chars is not overloaded for int128 in strict mode.
- template<typename _Int>
- static to_chars_result
- to_chars(char* __first, char* __last, _Int __value, int __base)
- { return std::__to_chars_i<_Int>(__first, __last, __value, __base); }
-#endif
-
_Spec<_CharT> _M_spec{};
};
diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits
index 2331c25..3567a32 100644
--- a/libstdc++-v3/include/std/limits
+++ b/libstdc++-v3/include/std/limits
@@ -1639,7 +1639,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#define __INT_N_U201103(TYPE)
#endif
-#if !defined(__STRICT_ANSI__)
#ifdef __GLIBCXX_TYPE_INT_N_0
__INT_N(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0,
__INT_N_201103 (__GLIBCXX_TYPE_INT_N_0),
@@ -1661,7 +1660,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__INT_N_U201103 (__GLIBCXX_TYPE_INT_N_3))
#endif
-#elif defined __STRICT_ANSI__ && defined __SIZEOF_INT128__
+#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__
__INT_N(__int128, 128,
__INT_N_201103 (__int128),
__INT_N_U201103 (__int128))
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 0554111..78a5ee8 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -464,6 +464,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_3>
: public true_type { };
#endif
+
+#if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
+ __extension__
+ template<>
+ struct __is_integral_helper<__int128>
+ : public true_type { };
+
+ __extension__
+ template<>
+ struct __is_integral_helper<unsigned __int128>
+ : public true_type { };
+#endif
+
/// @endcond
/// is_integral
@@ -519,7 +532,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public true_type { };
#endif
-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
+#ifdef _GLIBCXX_USE_FLOAT128
template<>
struct __is_floating_point_helper<__float128>
: public true_type { };
@@ -1927,6 +1940,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3>
{ using __type = unsigned __GLIBCXX_TYPE_INT_N_3; };
#endif
+#if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
+ __extension__
+ template<>
+ struct __make_unsigned<__int128>
+ { using __type = unsigned __int128; };
+#endif
// Select between integral and enum: not possible to be both.
template<typename _Tp,
@@ -2087,6 +2106,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3>
{ using __type = __GLIBCXX_TYPE_INT_N_3; };
#endif
+#if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
+ __extension__
+ template<>
+ struct __make_signed<unsigned __int128>
+ { using __type = __int128; };
+#endif
// Select between integral and enum: not possible to be both.
template<typename _Tp,
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index 61d4131..25ce8d9 100644
--- a/libstdc++-v3/libsupc++/exception
+++ b/libstdc++-v3/libsupc++/exception
@@ -57,8 +57,16 @@ namespace std _GLIBCXX_VISIBILITY(default)
class bad_exception : public exception
{
public:
- bad_exception() _GLIBCXX_USE_NOEXCEPT { }
+ _GLIBCXX26_CONSTEXPR bad_exception() _GLIBCXX_USE_NOEXCEPT { }
+#if __cplusplus >= 202400L
+ constexpr virtual ~bad_exception() _GLIBCXX_TXN_SAFE_DYN noexcept {}
+
+ constexpr virtual const char* what() const _GLIBCXX_TXN_SAFE_DYN noexcept
+ {
+ return "std::bad_exception";
+ }
+#else
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
@@ -66,6 +74,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
// See comment in eh_exception.cc.
virtual const char*
what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
+#endif
};
/// If you write a replacement %terminate handler, it must be of this type.
diff --git a/libstdc++-v3/libsupc++/exception.h b/libstdc++-v3/libsupc++/exception.h
index f8bca91..efb5fea 100644
--- a/libstdc++-v3/libsupc++/exception.h
+++ b/libstdc++-v3/libsupc++/exception.h
@@ -61,19 +61,28 @@ namespace std _GLIBCXX_VISIBILITY(default)
class exception
{
public:
- exception() _GLIBCXX_NOTHROW { }
+ _GLIBCXX26_CONSTEXPR exception() _GLIBCXX_NOTHROW { }
+#if __cplusplus >= 202400L
+ constexpr virtual ~exception() _GLIBCXX_TXN_SAFE_DYN noexcept {}
+#else
virtual ~exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
+#endif
#if __cplusplus >= 201103L
- exception(const exception&) = default;
- exception& operator=(const exception&) = default;
- exception(exception&&) = default;
- exception& operator=(exception&&) = default;
+ _GLIBCXX26_CONSTEXPR exception(const exception&) = default;
+ _GLIBCXX26_CONSTEXPR exception& operator=(const exception&) = default;
+ _GLIBCXX26_CONSTEXPR exception(exception&&) = default;
+ _GLIBCXX26_CONSTEXPR exception& operator=(exception&&) = default;
#endif
/** Returns a C-style character string describing the general cause
* of the current error. */
+#if __cplusplus >= 202400L
+ constexpr virtual const char*
+ what() const _GLIBCXX_TXN_SAFE_DYN noexcept { return "std::exception"; }
+#else
virtual const char*
what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
+#endif
};
/// @}
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index a6ff8c0..ee00915 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -75,14 +75,15 @@ namespace std _GLIBCXX_VISIBILITY(default)
exception_ptr current_exception() _GLIBCXX_USE_NOEXCEPT;
template<typename _Ex>
- exception_ptr make_exception_ptr(_Ex) _GLIBCXX_USE_NOEXCEPT;
+ _GLIBCXX26_CONSTEXPR exception_ptr make_exception_ptr(_Ex)
+ _GLIBCXX_USE_NOEXCEPT;
/// Throw the object pointed to by the exception_ptr.
void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__));
#if __cpp_lib_exception_ptr_cast >= 202506L
template<typename _Ex>
- const _Ex* exception_ptr_cast(const exception_ptr&) noexcept;
+ constexpr const _Ex* exception_ptr_cast(const exception_ptr&) noexcept;
template<typename _Ex>
void exception_ptr_cast(const exception_ptr&&) = delete;
#endif
@@ -105,7 +106,25 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
void* _M_exception_object;
+#if __cplusplus >= 202400L
+ constexpr explicit exception_ptr(void* __e) noexcept
+ : _M_exception_object(__e)
+ {
+ if (_M_exception_object)
+ {
+#if __cpp_if_consteval >= 202106L \
+ && _GLIBCXX_HAS_BUILTIN(__builtin_eh_ptr_adjust_ref)
+ if consteval {
+ __builtin_eh_ptr_adjust_ref(_M_exception_object, 1);
+ return;
+ }
+#endif
+ _M_addref();
+ }
+ }
+#else
explicit exception_ptr(void* __e) _GLIBCXX_USE_NOEXCEPT;
+#endif
void _M_addref() _GLIBCXX_USE_NOEXCEPT;
void _M_release() _GLIBCXX_USE_NOEXCEPT;
@@ -115,26 +134,29 @@ namespace std _GLIBCXX_VISIBILITY(default)
friend exception_ptr std::current_exception() _GLIBCXX_USE_NOEXCEPT;
friend void std::rethrow_exception(exception_ptr);
template<typename _Ex>
- friend exception_ptr std::make_exception_ptr(_Ex) _GLIBCXX_USE_NOEXCEPT;
+ friend _GLIBCXX26_CONSTEXPR exception_ptr std::make_exception_ptr(_Ex)
+ _GLIBCXX_USE_NOEXCEPT;
#if __cpp_lib_exception_ptr_cast >= 202506L
template<typename _Ex>
- friend const _Ex* std::exception_ptr_cast(const exception_ptr&) noexcept;
+ friend constexpr const _Ex* std::exception_ptr_cast(const exception_ptr&)
+ noexcept;
#endif
const void* _M_exception_ptr_cast(const type_info&) const
_GLIBCXX_USE_NOEXCEPT;
public:
- exception_ptr() _GLIBCXX_USE_NOEXCEPT;
+ _GLIBCXX26_CONSTEXPR exception_ptr() _GLIBCXX_USE_NOEXCEPT;
- exception_ptr(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT;
+ _GLIBCXX26_CONSTEXPR exception_ptr(const exception_ptr&)
+ _GLIBCXX_USE_NOEXCEPT;
#if __cplusplus >= 201103L
- exception_ptr(nullptr_t) noexcept
+ _GLIBCXX26_CONSTEXPR exception_ptr(nullptr_t) noexcept
: _M_exception_object(nullptr)
{ }
- exception_ptr(exception_ptr&& __o) noexcept
+ _GLIBCXX26_CONSTEXPR exception_ptr(exception_ptr&& __o) noexcept
: _M_exception_object(__o._M_exception_object)
{ __o._M_exception_object = nullptr; }
#endif
@@ -146,11 +168,11 @@ namespace std _GLIBCXX_VISIBILITY(default)
exception_ptr(__safe_bool) _GLIBCXX_USE_NOEXCEPT;
#endif
- exception_ptr&
+ _GLIBCXX26_CONSTEXPR exception_ptr&
operator=(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT;
#if __cplusplus >= 201103L
- exception_ptr&
+ _GLIBCXX26_CONSTEXPR exception_ptr&
operator=(exception_ptr&& __o) noexcept
{
exception_ptr(static_cast<exception_ptr&&>(__o)).swap(*this);
@@ -158,9 +180,9 @@ namespace std _GLIBCXX_VISIBILITY(default)
}
#endif
- ~exception_ptr() _GLIBCXX_USE_NOEXCEPT;
+ _GLIBCXX26_CONSTEXPR ~exception_ptr() _GLIBCXX_USE_NOEXCEPT;
- void
+ _GLIBCXX26_CONSTEXPR void
swap(exception_ptr&) _GLIBCXX_USE_NOEXCEPT;
#ifdef _GLIBCXX_EH_PTR_COMPAT
@@ -172,13 +194,13 @@ namespace std _GLIBCXX_VISIBILITY(default)
#endif
#if __cplusplus >= 201103L
- explicit operator bool() const noexcept
+ _GLIBCXX26_CONSTEXPR explicit operator bool() const noexcept
{ return _M_exception_object; }
#endif
#if __cpp_impl_three_way_comparison >= 201907L \
&& ! defined _GLIBCXX_EH_PTR_RELOPS_COMPAT
- friend bool
+ _GLIBCXX26_CONSTEXPR friend bool
operator==(const exception_ptr&, const exception_ptr&) noexcept = default;
#else
friend _GLIBCXX_EH_PTR_USED bool
@@ -198,31 +220,49 @@ namespace std _GLIBCXX_VISIBILITY(default)
};
_GLIBCXX_EH_PTR_USED
- inline
+ _GLIBCXX26_CONSTEXPR inline
exception_ptr::exception_ptr() _GLIBCXX_USE_NOEXCEPT
: _M_exception_object(0)
{ }
_GLIBCXX_EH_PTR_USED
- inline
+ _GLIBCXX26_CONSTEXPR inline
exception_ptr::exception_ptr(const exception_ptr& __other)
_GLIBCXX_USE_NOEXCEPT
: _M_exception_object(__other._M_exception_object)
{
if (_M_exception_object)
- _M_addref();
+ {
+#if __cpp_if_consteval >= 202106L \
+ && _GLIBCXX_HAS_BUILTIN(__builtin_eh_ptr_adjust_ref)
+ if consteval {
+ __builtin_eh_ptr_adjust_ref(_M_exception_object, 1);
+ return;
+ }
+#endif
+ _M_addref();
+ }
}
_GLIBCXX_EH_PTR_USED
- inline
+ _GLIBCXX26_CONSTEXPR inline
exception_ptr::~exception_ptr() _GLIBCXX_USE_NOEXCEPT
{
if (_M_exception_object)
- _M_release();
+ {
+#if __cpp_if_consteval >= 202106L \
+ && _GLIBCXX_HAS_BUILTIN(__builtin_eh_ptr_adjust_ref)
+ if consteval {
+ __builtin_eh_ptr_adjust_ref(_M_exception_object, -1);
+ return;
+ }
+#endif
+ _M_release();
+ }
}
_GLIBCXX_EH_PTR_USED
- inline exception_ptr&
+ _GLIBCXX26_CONSTEXPR inline exception_ptr&
exception_ptr::operator=(const exception_ptr& __other) _GLIBCXX_USE_NOEXCEPT
{
exception_ptr(__other).swap(*this);
@@ -230,7 +270,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
}
_GLIBCXX_EH_PTR_USED
- inline void
+ _GLIBCXX26_CONSTEXPR inline void
exception_ptr::swap(exception_ptr &__other) _GLIBCXX_USE_NOEXCEPT
{
void *__tmp = _M_exception_object;
@@ -239,7 +279,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
}
/// @relates exception_ptr
- inline void
+ _GLIBCXX26_CONSTEXPR inline void
swap(exception_ptr& __lhs, exception_ptr& __rhs)
{ __lhs.swap(__rhs); }
@@ -258,9 +298,21 @@ namespace std _GLIBCXX_VISIBILITY(default)
/// Obtain an exception_ptr pointing to a copy of the supplied object.
#if (__cplusplus >= 201103L && __cpp_rtti) || __cpp_exceptions
template<typename _Ex>
- exception_ptr
+ _GLIBCXX26_CONSTEXPR exception_ptr
make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT
{
+#if __cplusplus >= 202400L
+ if consteval {
+ try
+ {
+ throw __ex;
+ }
+ catch(...)
+ {
+ return current_exception();
+ }
+ }
+#endif
#if __cplusplus >= 201103L && __cpp_rtti
using _Ex2 = typename decay<_Ex>::type;
void* __e = __cxxabiv1::__cxa_allocate_exception(sizeof(_Ex));
@@ -293,7 +345,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
// instead of a working one compiled with RTTI and/or exceptions enabled.
template<typename _Ex>
__attribute__ ((__always_inline__))
- inline exception_ptr
+ _GLIBCXX26_CONSTEXPR inline exception_ptr
make_exception_ptr(_Ex) _GLIBCXX_USE_NOEXCEPT
{ return exception_ptr(); }
#endif
@@ -301,11 +353,33 @@ namespace std _GLIBCXX_VISIBILITY(default)
#if __cpp_lib_exception_ptr_cast >= 202506L
template<typename _Ex>
[[__gnu__::__always_inline__]]
- inline const _Ex* exception_ptr_cast(const exception_ptr& __p) noexcept
+ constexpr const _Ex* exception_ptr_cast(const exception_ptr& __p) noexcept
{
+ static_assert(!std::is_const_v<_Ex>);
+ static_assert(!std::is_reference_v<_Ex>);
+ static_assert(std::is_object_v<_Ex>);
+ static_assert(!std::is_array_v<_Ex>);
+ static_assert(!std::is_pointer_v<_Ex>);
+ static_assert(!std::is_member_pointer_v<_Ex>);
#ifdef __cpp_rtti
- const type_info &__id = typeid(const _Ex&);
- return static_cast<const _Ex*>(__p._M_exception_ptr_cast(__id));
+ if consteval {
+ if (__p._M_exception_object)
+ try
+ {
+ std::rethrow_exception(__p);
+ }
+ catch (const _Ex& __exc)
+ {
+ return &__exc;
+ }
+ catch (...)
+ {
+ }
+ return nullptr;
+ } else {
+ const type_info &__id = typeid(const _Ex&);
+ return static_cast<const _Ex*>(__p._M_exception_ptr_cast(__id));
+ }
#else
return nullptr;
#endif
diff --git a/libstdc++-v3/libsupc++/nested_exception.h b/libstdc++-v3/libsupc++/nested_exception.h
index c9f63e5..aff47bc 100644
--- a/libstdc++-v3/libsupc++/nested_exception.h
+++ b/libstdc++-v3/libsupc++/nested_exception.h
@@ -62,17 +62,24 @@ namespace std _GLIBCXX_VISIBILITY(default)
public:
/// The default constructor stores the current exception (if any).
+ _GLIBCXX26_CONSTEXPR
nested_exception() noexcept : _M_ptr(current_exception()) { }
+ _GLIBCXX26_CONSTEXPR
nested_exception(const nested_exception&) noexcept = default;
+ _GLIBCXX26_CONSTEXPR
nested_exception& operator=(const nested_exception&) noexcept = default;
+#if __cplusplus >= 202400L
+ constexpr virtual ~nested_exception() noexcept {}
+#else
virtual ~nested_exception() noexcept;
+#endif
/// Rethrow the stored exception, or terminate if none was stored.
[[noreturn]]
- void
+ _GLIBCXX26_CONSTEXPR void
rethrow_nested() const
{
if (_M_ptr)
@@ -81,7 +88,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
}
/// Access the stored exception.
- exception_ptr
+ _GLIBCXX26_CONSTEXPR exception_ptr
nested_ptr() const noexcept
{ return _M_ptr; }
};
@@ -91,11 +98,11 @@ namespace std _GLIBCXX_VISIBILITY(default)
template<typename _Except>
struct _Nested_exception : public _Except, public nested_exception
{
- explicit _Nested_exception(const _Except& __ex)
+ _GLIBCXX26_CONSTEXPR explicit _Nested_exception(const _Except& __ex)
: _Except(__ex)
{ }
- explicit _Nested_exception(_Except&& __ex)
+ _GLIBCXX26_CONSTEXPR explicit _Nested_exception(_Except&& __ex)
: _Except(static_cast<_Except&&>(__ex))
{ }
};
@@ -144,7 +151,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
*/
template<typename _Tp>
[[noreturn]]
- inline void
+ _GLIBCXX26_CONSTEXPR inline void
throw_with_nested(_Tp&& __t)
{
using _Up = typename decay<_Tp>::type;
@@ -204,7 +211,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
# if ! __cpp_rtti
[[__gnu__::__always_inline__]]
#endif
- inline void
+ _GLIBCXX26_CONSTEXPR inline void
rethrow_if_nested(const _Ex& __ex)
{
const _Ex* __ptr = __builtin_addressof(__ex);
diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new
index a550373..fb36dae 100644
--- a/libstdc++-v3/libsupc++/new
+++ b/libstdc++-v3/libsupc++/new
@@ -66,33 +66,51 @@ namespace std
class bad_alloc : public exception
{
public:
- bad_alloc() throw() { }
+ _GLIBCXX26_CONSTEXPR bad_alloc() throw() { }
#if __cplusplus >= 201103L
- bad_alloc(const bad_alloc&) = default;
- bad_alloc& operator=(const bad_alloc&) = default;
+ _GLIBCXX26_CONSTEXPR bad_alloc(const bad_alloc&) = default;
+ _GLIBCXX26_CONSTEXPR bad_alloc& operator=(const bad_alloc&) = default;
#endif
+#if __cplusplus >= 202400L
+ constexpr virtual ~bad_alloc() noexcept {}
+
+ constexpr virtual const char* what() const noexcept
+ {
+ return "std::bad_alloc";
+ }
+#else
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_alloc() throw();
// See comment in eh_exception.cc.
virtual const char* what() const throw();
+#endif
};
#if __cplusplus >= 201103L
class bad_array_new_length : public bad_alloc
{
public:
- bad_array_new_length() throw() { }
+ _GLIBCXX26_CONSTEXPR bad_array_new_length() throw() { }
+#if __cplusplus >= 202400L
+ constexpr virtual ~bad_array_new_length() noexcept {}
+
+ constexpr virtual const char* what() const noexcept
+ {
+ return "std::bad_array_new_length";
+ }
+#else
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_array_new_length() throw();
// See comment in eh_exception.cc.
virtual const char* what() const throw();
+#endif
};
#endif
diff --git a/libstdc++-v3/libsupc++/typeinfo b/libstdc++-v3/libsupc++/typeinfo
index 0a94b86..a31be7c 100644
--- a/libstdc++-v3/libsupc++/typeinfo
+++ b/libstdc++-v3/libsupc++/typeinfo
@@ -224,14 +224,23 @@ namespace std
class bad_cast : public exception
{
public:
- bad_cast() _GLIBCXX_USE_NOEXCEPT { }
+ _GLIBCXX26_CONSTEXPR bad_cast() _GLIBCXX_USE_NOEXCEPT { }
+#if __cplusplus >= 202400L
+ constexpr virtual ~bad_cast() noexcept {}
+
+ constexpr virtual const char* what() const noexcept
+ {
+ return "std::bad_cast";
+ }
+#else
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_cast() _GLIBCXX_USE_NOEXCEPT;
// See comment in eh_exception.cc.
virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;
+#endif
};
/**
@@ -241,14 +250,23 @@ namespace std
class bad_typeid : public exception
{
public:
- bad_typeid () _GLIBCXX_USE_NOEXCEPT { }
+ _GLIBCXX26_CONSTEXPR bad_typeid () _GLIBCXX_USE_NOEXCEPT { }
+#if __cplusplus >= 202400L
+ constexpr virtual ~bad_typeid() noexcept {}
+
+ constexpr virtual const char* what() const noexcept
+ {
+ return "std::bad_typeid";
+ }
+#else
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_typeid() _GLIBCXX_USE_NOEXCEPT;
// See comment in eh_exception.cc.
virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;
+#endif
};
} // namespace std
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/exception_ptr_cast.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/exception_ptr_cast.cc
index 6a6fbfe..de371d1 100644
--- a/libstdc++-v3/testsuite/18_support/exception_ptr/exception_ptr_cast.cc
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/exception_ptr_cast.cc
@@ -30,13 +30,13 @@ struct A { int a; };
struct B : A {};
struct C : B {};
struct D {};
-struct E : virtual C { int e; virtual ~E () {} };
+struct E : virtual C { int e; constexpr virtual ~E () {} };
struct F : virtual E, virtual C { int f; };
struct G : virtual F, virtual C, virtual E {
- G () : g (4) { a = 1; e = 2; f = 3; } int g;
+ constexpr G () : g (4) { a = 1; e = 2; f = 3; } int g;
};
-void test01()
+constexpr bool test01(bool x)
{
auto a = std::make_exception_ptr(C{ 42 });
auto b = std::exception_ptr_cast<C>(a);
@@ -73,9 +73,20 @@ void test01()
auto n = std::exception_ptr_cast<G>(a);
VERIFY( n == nullptr );
}
+ if (x)
+ throw 1;
+ return true;
}
+static_assert(test01(false));
+
int main()
{
- test01();
+ try
+ {
+ test01(true);
+ }
+ catch (...)
+ {
+ }
}