[gcc r16-5917] libstdc++: Use deducing this in std::bind_front even in C++20 [PR111327]
Patrick Palka
ppalka@gcc.gnu.org
Fri Dec 5 17:38:07 GMT 2025
https://gcc.gnu.org/g:b212314667d4cf636c7728d2c91f028c516e7df8
commit r16-5917-gb212314667d4cf636c7728d2c91f028c516e7df8
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Dec 5 12:15:08 2025 -0500
libstdc++: Use deducing this in std::bind_front even in C++20 [PR111327]
PR libstdc++/111327
libstdc++-v3/ChangeLog:
* include/bits/binders.h (_Binder::operator())
[_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Also use deducing this in
C++20 mode when possible.
* testsuite/20_util/function_objects/bind_front/111327.cc:
Expect error inside header even in C++20 mode.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Diff:
---
libstdc++-v3/include/bits/binders.h | 5 ++++-
libstdc++-v3/testsuite/20_util/function_objects/bind_front/111327.cc | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/include/bits/binders.h b/libstdc++-v3/include/bits/binders.h
index 6489edd5321b..972471745bd4 100644
--- a/libstdc++-v3/include/bits/binders.h
+++ b/libstdc++-v3/include/bits/binders.h
@@ -125,7 +125,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_bound_args(__make_bound_args<_BoundArgs...>(std::forward<_Args>(__args)...))
{ static_assert(sizeof...(_Args) == sizeof...(_BoundArgs)); }
-#if __cpp_explicit_this_parameter
+#if _GLIBCXX_EXPLICIT_THIS_PARAMETER
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wc++23-extensions" // deducing this
template<typename _Self, typename... _CallArgs>
constexpr _Result_t<_Self, _CallArgs...>
operator()(this _Self&& __self, _CallArgs&&... __call_args)
@@ -134,6 +136,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return _S_call(__like_t<_Self, _Binder>(__self),
std::forward<_CallArgs>(__call_args)...);
}
+# pragma GCC diagnostic pop
#else
template<typename... _CallArgs>
requires true
diff --git a/libstdc++-v3/testsuite/20_util/function_objects/bind_front/111327.cc b/libstdc++-v3/testsuite/20_util/function_objects/bind_front/111327.cc
index 58832a61a7eb..931886b7b54d 100644
--- a/libstdc++-v3/testsuite/20_util/function_objects/bind_front/111327.cc
+++ b/libstdc++-v3/testsuite/20_util/function_objects/bind_front/111327.cc
@@ -50,4 +50,4 @@ int main() {
std::move(std::as_const(g2))();
}
-// { dg-error "no type named 'type' in 'std::__conditional_t<false, std::invoke_result<" "" { target c++23 } 0 }
+// { dg-error "no type named 'type' in 'std::__conditional_t<false, std::invoke_result<" "" { target *-*-* } 0}
More information about the Libstdc++-cvs
mailing list