gcc/libstdc++-v3/testsuite/20_util/bind
Patrick Palka 83aab2f736 libstdc++: Use deducing this in std::bind when available [PR80564]
Implement the forwarding performed by std::bind via deducing this when
available, instead of needing 4 operator() overloads.  Using deducing
this here is more complicated than in other standard call wrappers
because std::bind is not really "perfect forwarding": it doesn't
consider value category, and along with const-ness it also forwards
volatile-ness (until C++20).

The old implementation suffers from the same problem that other
pre-C++23 SFINAE-friendly call wrappers have which is solved by using
deducing this (see p5.5 of the deducing this paper P0847R7).

	PR libstdc++/80564

libstdc++-v3/ChangeLog:

	* include/std/functional (__cv_like): New.
	(_Bind::_Res_type): Don't define when not needed.
	(_Bind::__dependent): Likewise.
	(_Bind::_Res_type_cv): Likewise.
	(_Bind::operator()) [_GLIBCXX_EXPLICIT_THIS_PARAMETER]:
	Define as two instead of four overloads using deducing
	this.
	* testsuite/20_util/bind/cv_quals_2.cc: Ignore SFINAE
	diagnostics inside headers.
	* testsuite/20_util/bind/ref_neg.cc: Likewise.
	* testsuite/20_util/bind/80564.cc: New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-12-05 21:09:34 -05:00
..
35569.cc Update copyright years. 2025-01-02 11:59:57 +01:00
38889.cc Update copyright years. 2025-01-02 11:59:57 +01:00
42593.cc Update copyright years. 2025-01-02 11:59:57 +01:00
45924.cc Update copyright years. 2025-01-02 11:59:57 +01:00
48698.cc Update copyright years. 2025-01-02 11:59:57 +01:00
49058_1.cc Update copyright years. 2025-01-02 11:59:57 +01:00
49058_2.cc Update copyright years. 2025-01-02 11:59:57 +01:00
57899.cc Update copyright years. 2025-01-02 11:59:57 +01:00
60497.cc Update copyright years. 2025-01-02 11:59:57 +01:00
68912.cc Update copyright years. 2025-01-02 11:59:57 +01:00
79798.cc Update copyright years. 2025-01-02 11:59:57 +01:00
80564.cc libstdc++: Use deducing this in std::bind when available [PR80564] 2025-12-05 21:09:34 -05:00
83427.cc Update copyright years. 2025-01-02 11:59:57 +01:00
91371.cc Update copyright years. 2025-01-02 11:59:57 +01:00
all_bound.cc Update copyright years. 2025-01-02 11:59:57 +01:00
constexpr.cc Update copyright years. 2025-01-02 11:59:57 +01:00
conv_result.cc Update copyright years. 2025-01-02 11:59:57 +01:00
cv_quals.cc Update copyright years. 2025-01-02 11:59:57 +01:00
cv_quals_2.cc libstdc++: Use deducing this in std::bind when available [PR80564] 2025-12-05 21:09:34 -05:00
cv_quals_3.cc Update copyright years. 2025-01-02 11:59:57 +01:00
dangling_ref.cc libstdc++: Explicitly pass -Wsystem-headers in tests that need it 2025-09-16 20:59:10 -04:00
is_placeholder_v.cc Update copyright years. 2025-01-02 11:59:57 +01:00
move.cc Update copyright years. 2025-01-02 11:59:57 +01:00
nested.cc Update copyright years. 2025-01-02 11:59:57 +01:00
placeholders.cc Update copyright years. 2025-01-02 11:59:57 +01:00
ref.cc Update copyright years. 2025-01-02 11:59:57 +01:00
ref2.cc Update copyright years. 2025-01-02 11:59:57 +01:00
ref_neg.cc libstdc++: Use deducing this in std::bind when available [PR80564] 2025-12-05 21:09:34 -05:00
refqual.cc Update copyright years. 2025-01-02 11:59:57 +01:00
socket.cc Update copyright years. 2025-01-02 11:59:57 +01:00