https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67114
--- Comment #15 from Jonathan Wakely <redi at gcc dot gnu.org> --- --- gcc-5.3.0.old/libstdc++-v3/include/std/thread 2015-03-26 20:59:08.000000000 +0100 +++ gcc-5.3.0.old/libstdc++-v3/include/std/thread 2016-03-17 06:32:41.124378000 +0100 @@ -83,10 +83,19 @@ operator==(thread::id __x, thread::id __y) noexcept { return __gthread_equal(__x._M_thread, __y._M_thread); } + // implement operator< explicitly in terms of the internals of + // pthreads-win32's ptw32_handle_t so that std::thread can use pthreads +#ifdef PTW32_VERSION + friend bool + operator<(thread::id __x, thread::id __y) + { return ( (__x._M_thread.p < __y._M_thread.p) || + ((__x._M_thread.p == __y._M_thread.p) && (__x._M_thread.x < __y._M_thread.x) ) ); } I suggest: return std::tie(__x._M_thread.p, __x._M_thread.x) < std::tie(__y._M_thread.p, __y._M_thread.x); +#else friend bool operator<(thread::id __x, thread::id __y) noexcept - { return __x._M_thread < __y._M_thread; } - + { return __less<native_handle_type>::_S_less(__x._M_thread, __y._M_thread); } +#endif + What's this?