]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Use consteval for _S_noexcept() helper functions
authorJonathan Wakely <jwakely@redhat.com>
Thu, 11 Sep 2025 08:55:12 +0000 (09:55 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 11 Sep 2025 13:38:59 +0000 (14:38 +0100)
These _S_noexcept() functions are only used in noexcept-specifiers and
never need to be called at runtime. They can be immediate functions,
i.e. consteval.

libstdc++-v3/ChangeLog:

* include/bits/iterator_concepts.h (_IterMove::_S_noexcept)
(_IterSwap::_S_noexcept): Change constexpr to consteval.
* include/bits/ranges_base.h (_Begin::_S_noexcept)
(_End::_S_noexcept, _RBegin::_S_noexcept, _REnd::_S_noexcept)
(_Size::_S_noexcept, _Empty::_S_noexcept, _Data::_S_noexcept):
Likewise.
* include/std/concepts (_Swap::_S_noexcept): Likewise.

Reviewed-by: Tomasz KamiƄski <tkaminsk@redhat.com>
libstdc++-v3/include/bits/iterator_concepts.h
libstdc++-v3/include/bits/ranges_base.h
libstdc++-v3/include/std/concepts

index 979039e7da53d91e590b039528dc351073bd702a..fd91b22d75a5c7ec3da57ddf20220e59f31bc500 100644 (file)
@@ -148,7 +148,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          };
 
        template<typename _Tp>
-         static constexpr bool
+         static consteval bool
          _S_noexcept()
          {
            if constexpr (__adl_imove<_Tp>)
@@ -884,7 +884,7 @@ namespace ranges
     {
     private:
       template<typename _Tp, typename _Up>
-       static constexpr bool
+       static consteval bool
        _S_noexcept()
        {
          if constexpr (__adl_iswap<_Tp, _Up>)
index 691a181bd29600b7c1258e86a224ddf4cd85dd93..27829086a35132d8b9142799e2c43c061f987220 100644 (file)
@@ -106,7 +106,7 @@ namespace ranges
     {
     private:
       template<typename _Tp>
-       static constexpr bool
+       static consteval bool
        _S_noexcept()
        {
          if constexpr (is_array_v<remove_reference_t<_Tp>>)
@@ -157,7 +157,7 @@ namespace ranges
     {
     private:
       template<typename _Tp>
-       static constexpr bool
+       static consteval bool
        _S_noexcept()
        {
          if constexpr (is_bounded_array_v<remove_reference_t<_Tp>>)
@@ -214,7 +214,7 @@ namespace ranges
     {
     private:
       template<typename _Tp>
-       static constexpr bool
+       static consteval bool
        _S_noexcept()
        {
          if constexpr (__member_rbegin<_Tp>)
@@ -272,7 +272,7 @@ namespace ranges
     {
     private:
       template<typename _Tp>
-       static constexpr bool
+       static consteval bool
        _S_noexcept()
        {
          if constexpr (__member_rend<_Tp>)
@@ -342,7 +342,7 @@ namespace ranges
     {
     private:
       template<typename _Tp>
-       static constexpr bool
+       static consteval bool
        _S_noexcept()
        {
          if constexpr (is_bounded_array_v<remove_reference_t<_Tp>>)
@@ -422,7 +422,7 @@ namespace ranges
     {
     private:
       template<typename _Tp>
-       static constexpr bool
+       static consteval bool
        _S_noexcept()
        {
          if constexpr (__member_empty<_Tp>)
@@ -468,7 +468,7 @@ namespace ranges
     {
     private:
       template<typename _Tp>
-       static constexpr bool
+       static consteval bool
        _S_noexcept()
        {
          if constexpr (__member_data<_Tp>)
index 5899f032434a4199c725eb0917db9c8c1a75a5cc..d9920a8f20a855a325009571e08842c6a5e35475 100644 (file)
@@ -204,7 +204,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       {
       private:
        template<typename _Tp, typename _Up>
-         static constexpr bool
+         static consteval bool
          _S_noexcept()
          {
            if constexpr (__adl_swap<_Tp, _Up>)