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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Jonathan Wakely
<r...@gcc.gnu.org>:

https://gcc.gnu.org/g:b5d04ffcdf30076bf80aa48f7a67404c20597141

commit r14-11450-gb5d04ffcdf30076bf80aa48f7a67404c20597141
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Tue Jul 16 09:43:06 2024 +0100

    libstdc++: Define operator== for hash table iterators [PR115939]

    Currently iterators for unordered containers do not directly define
    operator== and operator!= overloads. Instead they rely on the base class
    defining them, which is done so that iterator and const_iterator
    comparisons work using the same overloads.

    However this means a derived-to-base conversion is needed to call those
    operators, and PR libstdc++/115939 shows that this can be ambiguous (for
    -pedantic) when another overloaded operator could be used after an
    implicit conversion.

    This change defines operator== and operator!= directly for
    _Node_iterator and _Node_const_iterator so that no derived-to-base
    conversions are needed. The new overloads just forward to the base class
    ones, so the implementation is still shared and doesn't need to be
    duplicated.

    libstdc++-v3/ChangeLog:

            PR libstdc++/115939
            * include/bits/hashtable_policy.h (_Node_iterator): Add
            operator== and operator!=.
            (_Node_const_iterator): Likewise.
            * testsuite/23_containers/unordered_map/115939.cc: New test.

    (cherry picked from commit 591b71993f15ed95eb38f3314f3d9ac159b9d051)
  • [Bug libstdc++/115939] Cannot u... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to