[Bug libstdc++/101527] The implementation of std::common_iterator::operator== seems to be wrong

2021-07-21 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101527

--- Comment #3 from 康桓瑋  ---
(In reply to Jonathan Wakely from comment #2)
> I find it surprising, but the CWG consensus seems to be that a friend
> defined inline in the class body is "a member declaration of the befriended
> class".

Hey Jonathan, I just found out that std::counted_iterator also has the same
friend access issue.


#include 

int main() {
  std::counted_iterator it1;
  std::counted_iterator it2;
  return it1 == it2;
}

https://godbolt.org/z/jGT5jhbWz

[Bug libstdc++/101527] The implementation of std::common_iterator::operator== seems to be wrong

2021-07-21 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101527

--- Comment #2 from Jonathan Wakely  ---
I find it surprising, but the CWG consensus seems to be that a friend defined
inline in the class body is "a member declaration of the befriended class".

[Bug libstdc++/101527] The implementation of std::common_iterator::operator== seems to be wrong

2021-07-20 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101527

--- Comment #1 from 康桓瑋  ---
(In reply to 康桓瑋 from comment #0)
> 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:

This is the implementation divergence of CWG1699.