http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56278
Bug #: 56278
Summary: [4.8 Regression] unordered containers fail static
assertion
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: [email protected]
ReportedBy: [email protected]
#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.