Clang, std::shared_ptr и std::less/operator<

Наличие следующего кода

#include <memory>

int main() {
    std::shared_ptr<int> ptr0( new int );
    std::shared_ptr<int> ptr1( new int );

    bool result = ptr0 < ptr1;
}

приводит к следующей ошибке при компиляции с clang (версия 3.1, LLVM 3.1, Debian GNU/Linux Sid)

/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/bits/shared_ptr.h:364:14: error: no matching function for call to object of type 'std::less<_CT>'
      return std::less<_CT>()(__a.get(), __b.get());
             ^~~~~~~~~~~~~~~~
foo.cpp:9:21: note: in instantiation of function template specialization 'std::operator<<int, int>' requested here
        bool result = ptr0 < ptr1;
                           ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/bits/stl_function.h:236:7: note: candidate function not viable: no known conversion from 'int *' to 'int *&&&' for
      1st argument;
      operator()(const _Tp& __x, const _Tp& __y) const
      ^

Компиляция того же кода с GCC (версия 4.7.0 ) не выдает никаких сообщений об ошибках. Есть ли причина, по которой оператор <() не работает для общих указателей в clang?

8
задан stschindler 20 June 2012 в 08:04
поделиться