[Bug libstdc++/100863] 23_containers/unordered_{map,set}/allocator/default_init.cc still fail at runtime even after r12-1153

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 20 15:23:53 GMT 2021


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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:89ec3b67dbe856a447d068b053bc19559f136f43

commit r12-2415-g89ec3b67dbe856a447d068b053bc19559f136f43
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jul 20 15:20:41 2021 +0100

    libstdc++: fix is_default_constructible for hash containers [PR 100863]

    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 <jwakely@redhat.com>

    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.


More information about the Gcc-bugs mailing list