public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: "Franथईois Dumont" <fdumont@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-7882] libstdc++: _GLIBCXX_DEBUG Fix allocator-extended move constructor Date: Sun, 28 Mar 2021 20:27:37 +0000 (GMT) [thread overview] Message-ID: <20210328202737.D3E823857830@sourceware.org> (raw) https://gcc.gnu.org/g:d04c246cae674da081e1c9d8ba631560fee2fa91 commit r11-7882-gd04c246cae674da081e1c9d8ba631560fee2fa91 Author: François Dumont <fdumont@gcc.gnu.org> Date: Fri Mar 26 21:22:52 2021 +0100 libstdc++: _GLIBCXX_DEBUG Fix allocator-extended move constructor libstdc++-v3/ChangeLog: * include/debug/forward_list (forward_list(forward_list&&, const allocator_type&)): Add noexcept qualification. * include/debug/list (list(list&&, const allocator_type&)): Likewise and add call to safe container allocator aware move constructor. * include/debug/vector (vector(vector&&, const allocator_type&)): Fix noexcept qualification. * testsuite/23_containers/forward_list/cons/noexcept_move_construct.cc: Add allocator-extended move constructor noexceot qualification check. * testsuite/23_containers/list/cons/noexcept_move_construct.cc: Likewise. Diff: --- libstdc++-v3/include/debug/forward_list | 7 +++++-- libstdc++-v3/include/debug/list | 6 +++++- libstdc++-v3/include/debug/vector | 5 +++-- .../23_containers/forward_list/cons/noexcept_move_construct.cc | 6 +++++- .../testsuite/23_containers/list/cons/noexcept_move_construct.cc | 6 +++++- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/libstdc++-v3/include/debug/forward_list b/libstdc++-v3/include/debug/forward_list index db46705cc71..16f0531dce7 100644 --- a/libstdc++-v3/include/debug/forward_list +++ b/libstdc++-v3/include/debug/forward_list @@ -239,8 +239,11 @@ namespace __debug { } forward_list(forward_list&& __list, const allocator_type& __al) - : _Safe(std::move(__list._M_safe()), __al), - _Base(std::move(__list._M_base()), __al) + noexcept( + std::is_nothrow_constructible<_Base, + _Base, const allocator_type&>::value ) + : _Safe(std::move(__list._M_safe()), __al), + _Base(std::move(__list._M_base()), __al) { } explicit diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list index 06938899253..01fe43fc7df 100644 --- a/libstdc++-v3/include/debug/list +++ b/libstdc++-v3/include/debug/list @@ -119,7 +119,11 @@ namespace __debug : _Base(__x, __a) { } list(list&& __x, const allocator_type& __a) - : _Base(std::move(__x), __a) { } + noexcept( + std::is_nothrow_constructible<_Base, + _Base, const allocator_type&>::value ) + : _Safe(std::move(__x._M_safe()), __a), + _Base(std::move(__x._M_base()), __a) { } #endif explicit diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector index df179cbbfea..987bba17c2b 100644 --- a/libstdc++-v3/include/debug/vector +++ b/libstdc++-v3/include/debug/vector @@ -217,8 +217,9 @@ namespace __debug : _Base(__x, __a) { } vector(vector&& __x, const allocator_type& __a) - noexcept(noexcept( - _Base(std::declval<_Base&&>()), std::declval<const allocator_type&>())) + noexcept( + std::is_nothrow_constructible<_Base, + _Base, const allocator_type&>::value ) : _Safe(std::move(__x._M_safe()), __a), _Base(std::move(__x._M_base()), __a), _Safe_vector(std::move(__x)) { } diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/noexcept_move_construct.cc index 96f3876e4f6..0eb5a5cdbba 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/cons/noexcept_move_construct.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/noexcept_move_construct.cc @@ -23,4 +23,8 @@ typedef std::forward_list<int> fltype; -static_assert(std::is_nothrow_move_constructible<fltype>::value, "Error"); +static_assert( std::is_nothrow_move_constructible<fltype>::value, + "noexcept move constructor" ); +static_assert( std::is_nothrow_constructible<fltype, + fltype, const typename fltype::allocator_type&>::value, + "noexcept move constructor with allocator" ); diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/list/cons/noexcept_move_construct.cc index 5a2de10cf09..858a0d76333 100644 --- a/libstdc++-v3/testsuite/23_containers/list/cons/noexcept_move_construct.cc +++ b/libstdc++-v3/testsuite/23_containers/list/cons/noexcept_move_construct.cc @@ -23,4 +23,8 @@ typedef std::list<int> ltype; -static_assert(std::is_nothrow_move_constructible<ltype>::value, "Error"); +static_assert( std::is_nothrow_move_constructible<ltype>::value, + "noexcept move constructor" ); +static_assert( std::is_nothrow_constructible<ltype, + ltype, const typename ltype::allocator_type&>::value, + "noexcept move constructor with allocator" );
reply other threads:[~2021-03-28 20:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210328202737.D3E823857830@sourceware.org \ --to=fdumont@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@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: linkBe 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).