https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100863

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The problem seems to be that default initialization of an unordered_map/set
only default initializes the allocator object rather than value initializing
it.  This means the allocator's state doesn't get implicitly zeroed out, which
causes the assert inside test01() to fail.  A potential fix is to make
_Hashtable_alloc's default constructor value initialize the allocator object:

--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -1856,7 +1856,10 @@ namespace __detail
       using __buckets_alloc_traits =
std::allocator_traits<__buckets_alloc_type>;
       using __buckets_ptr = __node_base_ptr*;

-      _Hashtable_alloc() = default;
+      _Hashtable_alloc() noexcept(noexcept(__ebo_node_alloc()))
+      : __ebo_node_alloc()
+      { }
+
       _Hashtable_alloc(const _Hashtable_alloc&) = default;
       _Hashtable_alloc(_Hashtable_alloc&&) = default;

Reply via email to