From: Jonathan Wakely <jwakely@redhat.com>
To: "François Dumont" <frs.dumont@gmail.com>
Cc: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: Fix move_if_noexcept usages in _Hashtable
Date: Tue, 04 Dec 2018 14:38:00 -0000 [thread overview]
Message-ID: <20181204143836.GC27131@redhat.com> (raw)
In-Reply-To: <696186d1-b00c-4c42-6228-f00bba8e40ff@gmail.com>
On 04/12/18 07:45 +0100, François Dumont wrote:
>Hi
>
>Â This patch fix a minor problem with usage of std::move_if_noexcept.
>We use it to move node content if move construtor is noexcept but we
>eventually use the allocator_type::construct method which might be
>slightly different. I think it is better to check for this method
>noexcept qualification.
This is likely to pessimize some code, since most allocators do not
have an exception-specification on their construct members.
>Â Moreover I have added a special overload for nodes containing a
>std::pair. It is supposed to allow move semantic in associative
>containers where Key is stored as const deleting std::pair move
>constructor. In this case we should still move the Value part.
>
>Â It doesn't work for the moment because the std::pair piecewise
>constructor has no noexcept qualification. Is there any plan to add it
>? I think adding it will force including <tuple> in stl_pair.h, is it
>fine ?
>
>Â If this evolution is accepted I'll adapt it for _Rb_tree that has
>the same problem.
>
>Â Working on this I also notice that content of initialization_list is
>not moved. Is there a plan to make initialization_list iterator type
>like move_iterator ? Should containers use
>__make_move_iterator_if_noexcept ?
No.
Whether to allow moving from std::initializer_list is an active topic,
see
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1249r0.html
>Â Tested under Linux x86_64 normal mode.
>
>Â Ok to commit this first step ?
No, this is not suitable for stage 3. It seems too risky.
We can reconsider it during stage 1, but I'd like to see (at least) a
new test showing a bug with the current code. For example, a type with
a move constructor that is noexcept, but when used with a
scoped_allocator_adaptor (which calls something other than the move
constructor) we incorrectly move elements, and lose data when an
exception happens.
next prev parent reply other threads:[~2018-12-04 14:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-04 6:45 François Dumont
2018-12-04 14:38 ` Jonathan Wakely [this message]
2018-12-04 21:43 ` François Dumont
2018-12-16 18:10 ` François Dumont
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181204143836.GC27131@redhat.com \
--to=jwakely@redhat.com \
--cc=frs.dumont@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).