This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix libstdc++/55043 - issue with nesting unordered_map containing unique_ptr into vector


This fixes a regression caused by supporting the C++11 allocator
requirements in std::vector, and the fact that the unordered
containers don't have noexcept move constructors.  Fixed by
specializing is_copy_constructible for the unordered containers so
vector doesn't try to copy them when their element type is not
CopyInsertable into the container, and instead resorts to a move that
might throw.

        PR libstdc++/55043
        * include/std/unordered_map: Include alloc_traits.h
        * include/std/unordered_set: Likewise.
        * include/bits/alloc_traits.h: Define __is_copy_insertable.
        * include/bits/unordered_map.h: Use it.
        * include/bits/unordered_set.h: Likewise.
        * include/debug/unordered_map.h: Likewise.
        * include/debug/unordered_set.h: Likewise.
        * include/profile/unordered_map.h: Likewise.
        * include/profile/unordered_set.h: Likewise.
        * include/bits/hashtable.h: Fix comment typos.
        * testsuite/23_containers/unordered_map/55043.cc: New.
        * testsuite/23_containers/unordered_multimap/55043.cc: New.
        * testsuite/23_containers/unordered_multiset/55043.cc: New.
        * testsuite/23_containers/unordered_set/55043.cc: New.

Tested x86_64-linux, in normal, debug and profile modes.
Committed to trunk, to be committed to the 4.7 branch shortly.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]