diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-07-16 09:43:06 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2024-08-23 13:39:35 +0100 |
commit | 591b71993f15ed95eb38f3314f3d9ac159b9d051 (patch) | |
tree | c83626748dd39b885e372d904483d3613a4a45ed /gcc/dwarf2codeview.cc | |
parent | 125bab23ad75449333983c9389898c5b92b3aa0d (diff) | |
download | gcc-591b71993f15ed95eb38f3314f3d9ac159b9d051.zip gcc-591b71993f15ed95eb38f3314f3d9ac159b9d051.tar.gz gcc-591b71993f15ed95eb38f3314f3d9ac159b9d051.tar.bz2 |
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.
Diffstat (limited to 'gcc/dwarf2codeview.cc')
0 files changed, 0 insertions, 0 deletions