[Bug libstdc++/122921] The value_type of flat_map's iterator should be pair<Key, T> instead of pair<const Key, T>

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 2 02:59:38 GMT 2025


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122921

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:0a52c19d7307043a867606b0d9416bee540647fd

commit r15-10567-g0a52c19d7307043a867606b0d9416bee540647fd
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon Dec 1 17:08:01 2025 -0500

    libstdc++: Inconsistent const in flat_map's value_type [PR122921]

    flat_map's value_type is pair<key_type, mapped_type>, which we correctly
    define within the container but incorrectly within the iterator.

            PR libstdc++/122921

    libstdc++-v3/ChangeLog:

            * include/std/flat_map (_Flat_map_impl::_Iterator::value_type):
            Remove const from key_type to make consistent with the
            container's value_type.
            * testsuite/23_containers/flat_map/1.cc (test09): New test.
            * testsuite/23_containers/flat_multimap/1.cc (test09): New test.

    Reported-by: Vincent X
    Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
    (cherry picked from commit 3e02f86cd13c787331281ab098901f8a67381945)


More information about the Gcc-bugs mailing list