https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112490
--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:630bca9fa83236e108e9421549bdd5058133c3dd commit r14-11578-g630bca9fa83236e108e9421549bdd5058133c3dd Author: Patrick Palka <ppa...@redhat.com> Date: Wed Apr 9 17:48:05 2025 -0400 libstdc++: Fix constraint recursion in basic_const_iterator operator- [PR115046] It was proposed in PR112490 to also adjust basic_const_iterator's friend operator-(sent, iter) overload alongside the r15-7757-g4342c50ca84ae5 adjustments to its comparison operators, but we lacked a concrete testcase demonstrating fixable constraint recursion there. It turns out Hewill Kang's PR115046 is such a testcase! So this patch makes the same adjustments to that overload as well, fixing PR115046. The LWG 4218 P/R will need to get adjusted too. PR libstdc++/115046 PR libstdc++/112490 libstdc++-v3/ChangeLog: * include/bits/stl_iterator.h (basic_const_iterator::operator-): Replace non-dependent basic_const_iterator function parameter with a dependent one of type basic_const_iterator<_It2> where _It2 matches _It. * testsuite/std/ranges/adaptors/as_const/1.cc (test04): New test. Reviewed-by: Jonathan Wakely <jwak...@redhat.com> (cherry picked from commit d69f73c0334486f3c66937388f02008736809e87)