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

Jonathan Wakely jwakely.gcc@gmail.com
Wed Jan 16 09:44:00 GMT 2013


On 16 January 2013 09:25, Jonathan Wakely wrote:
> 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.

Daniel K has pointed out a problem with this fix, so I'll try to fix
it again, properly, this evening.



More information about the Gcc-patches mailing list