http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52309
Bug #: 52309 Summary: [c++0x] unordered_set illegally requires value_type::operator!= Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ro...@binarylife.net $ cat test.cpp #include <unordered_set> struct value {}; struct hash { std::size_t operator()(value const&)const; }; bool operator==(value const&,value const&); std::unordered_set<value,hash> set; bool z=(set==set); $ g++ -std=c++0x -c test.cpp 2>&1 | egrep error ...../include/c++/4.7.0/bits/hashtable_policy.h:1116:4: error: no match for ‘operator!=’ in ‘__ity.std::__detail::_Node_const_iterator<_Value, __constant_iterators, __cache>::operator*<value, true, true>() != __itx.std::__detail::_Node_const_iterator<_Value, __constant_iterators, __cache>::operator*<value, true, true>()’ "set==set" needs operator!=(value,value). The "value" type is EqualityComparable and looks good for unordered_set. (17.6.3.1, 23.2.1, 23.2.5/2 and 23.2.5/11) All other associative unordered containers do not need value_type::operator!=(). Only unordered_set requires it.