This is the mail archive of the mailing list for the GCC 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]

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

On 16 January 2013 23:57, Jonathan Wakely wrote:
> Here's another attempt to fix this regression, I hope this time it
> doesn't cause more problems than it solves.
> Instead of specializing is_copy_constructible for the unordered
> containers this causes their copy constructors to be deleted if the
> value_type is not CopyInsertable into the container.  This makes
> is_copy_constructible naturally give the right result, and so
> __move_if_noexcept does the right thing and the testcase in the PR
> passes. Yay.
> As Daniel pointed out in the PR comments, the unfortunate side effect
> of this approach is that we can no longer support instantiating
> unordered containers with incomplete types. That's undefined
> behaviour, but was allowed as QoI.  Conformance trumps QoI, I'm
> afraid.  If someday we have noexcept move constructors for the
> unordered containers we could allow incomplete types again.
>         PR libstdc++/55043 (again)
>         * include/bits/alloc_traits.h (allocator_traits::construct): Disable
>         unless construction would be well-formed.
>         (__allow_copy_cons, __check_copy_constructible): Define.
>         * include/bits/unordered_map.h (__check_copy_constructible): Use as
>         base class so copy constructor will be deleted if appropriate.
>         (is_copy_constructible): Remove specialization.
>         * include/bits/unordered_set.h: Likewise.
>         * include/debug/unordered_map.h: Undo previous commit. Default copy
>         and move constructors.
>         * include/debug/unordered_set.h: Likewise.
>         * include/profile/unordered_map.h: Undo previous commit.
>         * include/profile/unordered_set.h: Likewise.
>         * testsuite/23_containers/unordered_map/ Fix test.
>         * testsuite/23_containers/unordered_multimap/ Likewise.
>         * testsuite/23_containers/unordered_multiset/ Likewise.
>         * testsuite/23_containers/unordered_set/ Likewise.
>         * testsuite/23_containers/unordered_map/requirements/ XFAIL,
>         cannot support incomplete types.
>         * testsuite/23_containers/unordered_multimap/requirements/
>         Likewise.
> Tested x86_86-linux, committed to trunk.

I plan to commit the attached to the 4.7 branch to fix the regression there too.

Attachment: patch-c.txt
Description: Text document

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