https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100795
--- Comment #21 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:4fc387e2f6990986d72b023ee44b4e0030903247 commit r16-1746-g4fc387e2f6990986d72b023ee44b4e0030903247 Author: Patrick Palka <ppa...@redhat.com> Date: Fri Jun 27 13:53:37 2025 -0400 libstdc++: Directly implement ranges::sample [PR100795] PR libstdc++/100795 libstdc++-v3/ChangeLog: * include/bits/ranges_algo.h (__sample_fn::operator()): Reimplement the forward_iterator branch directly, based on the stl_algo.h implementation. Add explicit cast to _Out's difference_type in the !forward_iterator branch. * testsuite/25_algorithms/sample/constrained.cc (test02): New test. Reviewed-by: Jonathan Wakely <jwak...@redhat.com>