This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch] Fix libstdc++/55043 - issue with nesting unordered_map containing unique_ptr into vector
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 16 Jan 2013 09:44:02 +0000
- Subject: Re: [patch] Fix libstdc++/55043 - issue with nesting unordered_map containing unique_ptr into vector
- References: <CAH6eHdT2avC6qkM6Y7u4mAvj49TMc2-GiJ+eZxGHzJv8EttEJw@mail.gmail.com>
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.