Before pushing I checked other std::erase_if and std::erase implementations, so this new patch.

    libstdc++: Avoid _GLIBCXX20_CONSTEXPR in C++ >= 20 code sections

    libstdc++-v3/ChangeLog:

            * include/std/vector (std::erase_if, std::erase): Replace _GLIBCXX20_CONSTEXPR
            with 'constexpr' and remove implied 'inline' keyword.
            * include/std/string (std::erase_if, std::erase): Likewise.
            * include/std/deque (std::erase_if, std::erase): Replace 'inline' with
            'constexpr'.

Still ok to commit ?

François


On 10/1/25 10:58, Jonathan Wakely wrote:
On Wed, 1 Oct 2025 at 06:16, François Dumont <[email protected]> wrote:
Hi

Minor patch, just need to confirm that constexpr implies inline, no ?
That's correct. This is a good cleanup.

      libstdc++: Avoid _GLIBCXX20_CONSTEXPR in C++ >= 20 code section

      libstdc++-v3/ChangeLog:

              * include/std/vector (std::erase_if): Replace
_GLIBCXX20_CONSTEXPR
              with 'constexpr' and remove implied 'inline' keyword.

Ok to commit ?
OK, thanks.
diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque
index c82f9dff286..a08f823153b 100644
--- a/libstdc++-v3/include/std/deque
+++ b/libstdc++-v3/include/std/deque
@@ -100,7 +100,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _Tp, typename _Alloc, typename _Predicate>
-    inline typename deque<_Tp, _Alloc>::size_type
+    constexpr typename deque<_Tp, _Alloc>::size_type
     erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred)
     {
       using namespace __gnu_cxx;
@@ -121,7 +121,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _Tp, typename _Alloc,
           typename _Up _GLIBCXX26_DEF_VAL_T(_Tp)>
-    inline typename deque<_Tp, _Alloc>::size_type
+    constexpr typename deque<_Tp, _Alloc>::size_type
     erase(deque<_Tp, _Alloc>& __cont, const _Up& __value)
     { return std::erase_if(__cont, __gnu_cxx::__ops::__equal_to(__value)); }
 
diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string
index 4b84aeaa857..97ded057a87 100644
--- a/libstdc++-v3/include/std/string
+++ b/libstdc++-v3/include/std/string
@@ -95,8 +95,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _CharT, typename _Traits, typename _Alloc,
           typename _Predicate>
-    _GLIBCXX20_CONSTEXPR
-    inline typename basic_string<_CharT, _Traits, _Alloc>::size_type
+    constexpr typename basic_string<_CharT, _Traits, _Alloc>::size_type
     erase_if(basic_string<_CharT, _Traits, _Alloc>& __cont, _Predicate __pred)
     {
       using namespace __gnu_cxx;
@@ -110,8 +109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _CharT, typename _Traits, typename _Alloc,
           typename _Up _GLIBCXX26_DEF_VAL_T(_CharT)>
-    _GLIBCXX20_CONSTEXPR
-    inline typename basic_string<_CharT, _Traits, _Alloc>::size_type
+    constexpr typename basic_string<_CharT, _Traits, _Alloc>::size_type
     erase(basic_string<_CharT, _Traits, _Alloc>& __cont, const _Up& __value)
     { return std::erase_if(__cont, __gnu_cxx::__ops::__equal_to(__value)); }
 
diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector
index cdc30cbff6d..3146f283944 100644
--- a/libstdc++-v3/include/std/vector
+++ b/libstdc++-v3/include/std/vector
@@ -112,8 +112,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _Tp, typename _Alloc, typename _Predicate>
-    _GLIBCXX20_CONSTEXPR
-    inline typename vector<_Tp, _Alloc>::size_type
+    constexpr typename vector<_Tp, _Alloc>::size_type
     erase_if(vector<_Tp, _Alloc>& __cont, _Predicate __pred)
     {
       using namespace __gnu_cxx;
@@ -134,8 +133,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _Tp, typename _Alloc,
           typename _Up _GLIBCXX26_DEF_VAL_T(_Tp)>
-    _GLIBCXX20_CONSTEXPR
-    inline typename vector<_Tp, _Alloc>::size_type
+    constexpr typename vector<_Tp, _Alloc>::size_type
     erase(vector<_Tp, _Alloc>& __cont, const _Up& __value)
     { return std::erase_if(__cont, __gnu_cxx::__ops::__equal_to(__value)); }
 

Reply via email to