http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49219
Summary: [c++0x] comparing unordered containers illegally require key compare 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> #include <unordered_map> struct K { // bool operator!=(K const&)const; // bool operator==(K const&)const; }; struct H { std::size_t operator()(K const&)const; }; struct E { bool operator()(K const&,K const&)const; }; extern std::unordered_set<K,H,E> a; extern std::unordered_map<K,int,H,E> b; extern std::unordered_multiset<K,H,E> c; extern std::unordered_multimap<K,int,H,E> d; bool af=(a==a); bool bf=(b==b); bool cf=(c==c); bool df=(d==d); $ g++ -c -std=c++0x test.cpp ... failure Each of "bool xf=(x==x);" require "bool K::operator!=(K const&)const" and/or "bool K::operator==(K const&)const". The provided E type should be used for key compare.