http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56267
Bug #: 56267 Summary: [4.7/4.8 Regression] unordered containers require Assignable hash function Classification: Unclassified Product: gcc Version: 4.7.3 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: r...@gcc.gnu.org #include <unordered_set> struct hash : std::hash<int> { hash& operator=(const hash&) = delete; }; int main() { std::unordered_set<int, hash> s{ 0, 1, 2 }; auto i = s.begin(0); i = i; } The standard does not require hash functions to be assignable. We must cache the hash code unless is_copy_assignable<H> is true, I'm testing the fix.