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.
This commit is contained in:
François Dumont 2021-03-26 21:22:52 +01:00
parent 46720db72c
commit d04c246cae
5 changed files with 23 additions and 7 deletions

View file

@ -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

View file

@ -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

View file

@ -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)) { }

View file

@ -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" );

View file

@ -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" );