https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101527
Bug ID: 101527
Summary: The implementation of std::common_iterator::operator==
seems to be wrong
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
Libstdc++'s implementation of common_iterator is similar to MSVC-STL, it
defines operator== inside the class and declares template common_iterator class
as a friend.
But according to the description of [class.friend#10]: "Friendship is neither
inherited nor transitive." this will cause the following valid codes to be
rejected:
std::common_iterator<int*, std::unreachable_sentinel_t> it1;
std::common_iterator<const int*, std::unreachable_sentinel_t> it2;
it1 == it2;
https://godbolt.org/z/15ao981Wb