]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
xlist: use friend instead of member operators
authorCasey Bodley <cbodley@redhat.com>
Fri, 11 Feb 2022 23:56:30 +0000 (18:56 -0500)
committerKefu Chai <tchaikov@gmail.com>
Thu, 17 Mar 2022 14:00:35 +0000 (22:00 +0800)
commit0b22b85817223cdfee6a6ab42f2ff27752fa05df
treee9f993e40d24790c4230b46487c20ef92bb18d82
parentb779a1762e2b64f0da05cb8004db70da706cb4cf
xlist: use friend instead of member operators

resolves a c++20 compilation error with clang 13:

In file included from ceph/src/client/Client.cc:55:
In file included from ceph/src/messages/MClientCaps.h:19:
In file included from ceph/src/mds/mdstypes.h:22:
ceph/src/include/xlist.h:212:27: warning: ISO C++20 considers use of overloaded operator '!=' (with operand types 'xlist<Dentry *>::const_iterat
or' and 'xlist<Dentry *>::const_iterator') to be ambiguous despite there being a unique best viable function with non-reversed arguments [-Wambiguous-reversed
-operator]
    for (const auto &item : list) {
                          ^
ceph/src/client/Client.cc:3299:63: note: in instantiation of member function 'operator<<' requested here
    ldout(cct, 20) << "link  inode " << in << " parents now " << in->dentries << dendl;
                                                              ^
ceph/src/include/xlist.h:202:10: note: candidate function with non-reversed arguments
    bool operator!=(const_iterator& rhs) const {
         ^
ceph/src/include/xlist.h:199:10: note: ambiguous candidate function with reversed arguments
    bool operator==(const_iterator& rhs) const {
         ^

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/include/xlist.h