On 02/06/21 13:35 +0100, Jonathan Wakely wrote: >The allocator, hash function and equality function should all be >value-initialized by the default constructor of an unordered container. >Do it in the EBO helper, so we don't have to get it right in multiple >places. > >Signed-off-by: Jonathan Wakely > >libstdc++-v3/ChangeLog: > > PR libstdc++/100863 > PR libstdc++/65816 > * include/bits/hashtable_policy.h (_Hashtable_ebo_helper): > Value-initialize subobject. > * testsuite/23_containers/unordered_map/allocator/default_init.cc: > Remove XFAIL. > * testsuite/23_containers/unordered_set/allocator/default_init.cc: > Remove XFAIL. The recent change to _Hashtable_ebo_helper for this PR broke the is_default_constructible trait for a hash container with a non-default constructible allocator. That happens because the constructor needs to be user-provided in order to initialize the member, and so is not defined as deleted when the type is not default constructible. By making _Hashtable derive from _Enable_special_members we can ensure that the default constructor for the std::unordered_xxx containers is deleted when it would be ill-formed. This makes the trait give the correct answer. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: PR libstdc++/100863 * include/bits/hashtable.h (_Hashtable): Conditionally delete default constructor by deriving from _Enable_special_members. * testsuite/23_containers/unordered_map/cons/default.cc: New test. * testsuite/23_containers/unordered_set/cons/default.cc: New test. Tested powerpc64le-linux. Committed to trunk.