[Bug libstdc++/98466] New: Iterators for unordered containers do not

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 28 20:14:22 GMT 2020


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

            Bug ID: 98466
           Summary: Iterators for unordered containers do not
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#define _GLIBCXX_DEBUG 1
#include <unordered_set>

int main()
{
  std::unordered_set<int>::iterator it{};
  it == it;
}

This aborts at runtime:

/home/jwakely/gcc/11/include/c++/11.0.0/debug/safe_iterator.h:461:
In function:
    bool __gnu_debug::operator==(const _Self&, const _Self&)

Error: attempt to compare a singular iterator to a singular iterator.

Objects involved in the operation:
    iterator "__lhs" @ 0x0x7ffc0e6d5940 {
      type = std::__detail::_Node_iterator<int, true, false> (mutable
iterator);
      state = singular;
    }
    iterator "__rhs" @ 0x0x7ffc0e6d5940 {
      type = std::__detail::_Node_iterator<int, true, false> (mutable
iterator);
      state = singular;
    }
Aborted (core dumped)


It seems that https://wg21.link/n3644 was not implemented for the debug mode
iterators.


More information about the Gcc-bugs mailing list