[Bug libstdc++/122842] [LWG3946] Compiler error when passing std::ranges::cbegin to a function with std::ranges::const_iterator_t as a template parameter
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 28 20:38:45 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122842
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:2d3142c00934c419755c17dd85ecdb0e72f249d1
commit r16-5697-g2d3142c00934c419755c17dd85ecdb0e72f249d1
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Nov 28 15:38:04 2025 -0500
libstdc++: Correctly implement LWG 3946 changes to const_iterator_t
[PR122842]
LWG 3946 made const_iterator_t/sentinel_t agree with ranges::cbegin/cend
by defining the aliases in terms of the CPOs, but I defined it the other
way around in an incorrect way that made the aliases not consider
range-ness of const T via __possibly_const_range. This patch
reimplements the proposed resolution in a more obviously correct way,
mirroring the wording.
PR libstdc++/122842
libstdc++-v3/ChangeLog:
* include/bits/ranges_base.h (__access:_CBegin): Define in
terms of const_iterator directly, not const_iterator_t.
(__access::_CEnd): Likewise in terms of const_sentinel vs
const_sentinel_t.
(const_iterator_t): Move down definition and define in terms
of ranges::cbegin as per LWG 3946.
(const_sentinel_t): Likewise in terms of ranges::cend.
* testsuite/24_iterators/const_iterator/1.cc (test02): Correct
test for int[], std::array and std::vector. Also test
std::string.
Reviewed-by: Tomasz KamiÅski <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
More information about the Gcc-bugs
mailing list