#include <unordered_set> struct hash : std::hash<int> { hash() { } }; std::unordered_set<int, hash>::local_iterator i; In file included from /home/jwakely/gcc/4.x/include/c++/4.8.0/unordered_set:47:0, from h.cc:1: /home/jwakely/gcc/4.x/include/c++/4.8.0/bits/hashtable.h: In instantiation of ‘class std::_Hashtable<int, int, std::allocator<int>, std::__detail::_Identity, std::equal_to<int>, hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >’: /home/jwakely/gcc/4.x/include/c++/4.8.0/bits/unordered_set.h:96:18: required from ‘class std::unordered_set<int, hash>’ h.cc:9:30: required from here /home/jwakely/gcc/4.x/include/c++/4.8.0/bits/hashtable.h:267:7: error: static assertion failed: Cache the hash code or make functors involved in hash code and bucket index computation default constructible static_assert(__if_hash_not_cached< ^ I think the problem is that the default constructor of _Hash_code_base is not public, so checking is_default_constructible fails.
Author: redi Date: Mon Feb 11 00:19:14 2013 New Revision: 195935 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195935 Log: PR libstdc++/56278 * include/bits/hashtable_policy.h (_Hash_code_base): Make default constructor public. * testsuite/23_containers/unordered_set/56278.cc: New. Added: trunk/libstdc++-v3/testsuite/23_containers/unordered_set/56278.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/hashtable_policy.h
fixed