Commit 8b7a1b87 authored by Milian Wolff's avatar Milian Wolff

Fix argument dependent lookup: put operators into correct namespace.

This fixes the built with clang for me, also see the note at the end
of the error message:

In file included from /home/milian/projects/kf5/src/kde/pim/kdepim-addons/plugins/plasma/pimeventsplugin/autotests/eventdatavisitortest.cpp:20:
In file included from /home/milian/projects/kf5/src/kde/pim/kdepim-addons/plugins/plasma/pimeventsplugin/autotests/eventdatavisitortest.h:23:
In file included from /usr/include/qt/QtCore/QObject:1:
In file included from /usr/include/qt/QtCore/qobject.h:47:
In file included from /usr/include/qt/QtCore/qstring.h:49:
In file included from /usr/include/qt/QtCore/qbytearray.h:52:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/string:48:
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/stl_function.h:387:20: error: call to function 'operator<' that is neither visible in the template definition nor found by argument-dependent lookup
      { return __x < __y; }
                   ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/predefined_ops.h:144:16: note: in instantiation of member function 'std::less<CalendarEvents::EventData>::operator()' requested here
        { return bool(_M_comp(*__it, __val)); }
                      ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/stl_heap.h:129:42: note: in instantiation of function template specialization '__gnu_cxx::__ops::_Iter_comp_val<std::less<CalendarEvents::EventData> >::operator()<QList<CalendarEvents::EventData>::iterator, CalendarEvents::EventData>' requested here
      while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
                                         ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/stl_heap.h:230:12: note: in instantiation of function template specialization 'std::__push_heap<QList<CalendarEvents::EventData>::iterator, long long, CalendarEvents::EventData, __gnu_cxx::__ops::_Iter_comp_val<std::less<CalendarEvents::EventData> > >' requested here
      std::__push_heap(__first, __holeIndex, __topIndex,
           ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/stl_heap.h:335:9: note: in instantiation of function template specialization 'std::__adjust_heap<QList<CalendarEvents::EventData>::iterator, long long, CalendarEvents::EventData, __gnu_cxx::__ops::_Iter_comp_iter<std::less<CalendarEvents::EventData> > >' requested here
          std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value),
               ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/stl_algo.h:1669:12: note: in instantiation of function template specialization 'std::__make_heap<QList<CalendarEvents::EventData>::iterator, __gnu_cxx::__ops::_Iter_comp_iter<std::less<CalendarEvents::EventData> > >' requested here
      std::__make_heap(__first, __middle, __comp);
           ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/stl_algo.h:1930:12: note: in instantiation of function template specialization 'std::__heap_select<QList<CalendarEvents::EventData>::iterator, __gnu_cxx::__ops::_Iter_comp_iter<std::less<CalendarEvents::EventData> > >' requested here
      std::__heap_select(__first, __middle, __last, __comp);
           ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/stl_algo.h:1945:13: note: in instantiation of function template specialization 'std::__partial_sort<QList<CalendarEvents::EventData>::iterator, __gnu_cxx::__ops::_Iter_comp_iter<std::less<CalendarEvents::EventData> > >' requested here
              std::__partial_sort(__first, __last, __last, __comp);
                   ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/stl_algo.h:1965:9: note: in instantiation of function template specialization 'std::__introsort_loop<QList<CalendarEvents::EventData>::iterator, int, __gnu_cxx::__ops::_Iter_comp_iter<std::less<CalendarEvents::EventData> > >' requested here
          std::__introsort_loop(__first, __last,
               ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/stl_algo.h:4746:12: note: in instantiation of function template specialization 'std::__sort<QList<CalendarEvents::EventData>::iterator, __gnu_cxx::__ops::_Iter_comp_iter<std::less<CalendarEvents::EventData> > >' requested here
      std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
           ^
/home/milian/projects/kf5/src/kde/pim/kdepim-addons/plugins/plasma/pimeventsplugin/autotests/eventdatavisitortest.cpp:248:10: note: in instantiation of function template specialization 'std::sort<QList<CalendarEvents::EventData>::iterator, std::less<CalendarEvents::EventData> >' requested here
    std::sort(resultValues.begin(), resultValues.end(), std::less<CalendarEvents::EventData>());
         ^
/home/milian/projects/kf5/src/kde/pim/kdepim-addons/plugins/plasma/pimeventsplugin/autotests/testutils.h:51:6: note: 'operator<' should be declared prior to the call site or in namespace 'CalendarEvents'
bool operator<(const CalendarEvents::EventData &lhs, const CalendarEvents::EventData &rhs)
     ^
parent e6faa50f
......@@ -33,7 +33,8 @@ QDebug operator<<(QDebug dbg, const CalendarEvents::EventData &data)
return dbg;
}
bool operator==(const CalendarEvents::EventData &lhs, const CalendarEvents::EventData &rhs)
namespace CalendarEvents {
bool operator==(const EventData &lhs, const EventData &rhs)
{
return lhs.uid() == rhs.uid()
&& lhs.type() == rhs.type()
......@@ -46,9 +47,7 @@ bool operator==(const CalendarEvents::EventData &lhs, const CalendarEvents::Even
&& lhs.eventColor() == rhs.eventColor();
}
namespace std
{
bool operator<(const CalendarEvents::EventData &lhs, const CalendarEvents::EventData &rhs)
bool operator<(const EventData &lhs, const EventData &rhs)
{
if (lhs.startDateTime() != rhs.startDateTime()) {
return lhs.startDateTime() < rhs.startDateTime();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment