Invalid operands to binary expression when performing lstFolders.sort()



  • The last kopano-core snapshot (1281) does not build with clang on my OpenBSD/amd64 system. The snapshot before did. Here is the error. I am investigating this, but in the meantime I thought someone more knowledgeable from the inside might fix it faster.

    In file included from provider/libserver/ECConvenientDepthObjectTable.cpp:18:
    In file included from ./common/include/kopano/platform.h:30:
    In file included from ./common/include/kopano/platform.linux.h:26:
    In file included from /usr/include/c++/v1/vector:266:
    In file included from /usr/include/c++/v1/__bit_reference:15:
    /usr/include/c++/v1/algorithm:708:71: error: invalid operands to binary expressi
    on ('const KC::FOLDERINFO' and 'const KC::FOLDERINFO')
        bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
                                                                      ~~~ ^ ~~~
    /usr/include/c++/v1/list:2238:13: note: in instantiation of member function 'std
    ::__1::__less<KC::FOLDERINFO, KC::FOLDERINFO>::operator()' requested here
            if (__comp(*--__e2, *__f1))
                ^
    /usr/include/c++/v1/list:2224:5: note: in instantiation of function template spe
    cialization 'std::__1::list<KC::FOLDERINFO, std::__1::allocator<KC::FOLDERINFO>
    >::__sort<std::__1::__less<KC::FOLDERINFO, KC::FOLDERINFO> >' requested here
        __sort(begin(), end(), base::__sz(), __comp);
        ^
    /usr/include/c++/v1/list:2215:5: note: in instantiation of function template spe
    cialization 'std::__1::list<KC::FOLDERINFO, std::__1::allocator<KC::FOLDERINFO>
    >::sort<std::__1::__less<KC::FOLDERINFO, KC::FOLDERINFO> >' requested here
        sort(__less<value_type>());
        ^
    provider/libserver/ECConvenientDepthObjectTable.cpp:179:13: note: in instantiati
    on of member function 'std::__1::list<KC::FOLDERINFO, std::__1::allocator<KC::FO
    LDERINFO> >::sort' requested here
            lstFolders.sort();
                       ^
    


  • Making the compare operator const fixed the error for me (which makes sense since we are calling the function from a const object).

    bool operator <(const FOLDERINFO &a) const {
    

    Diff here.


Log in to reply
 

Looks like your connection to Kopano Community Forum was lost, please wait while we try to reconnect.