Commit c5d9ec56 by Jonathan Wakely Committed by Jonathan Wakely

c++config (_GLIBCXX_NOEXCEPT_IF): Define.

	* include/bits/c++config (_GLIBCXX_NOEXCEPT_IF): Define.
	* include/bits/forward_list.h (forward_list::swap): Make noexcept
	unconditional.
	* include/bits/hashtable.h (_Hashtable::swap): Do not use
	_S_nothrow_swap().
	* include/bits/stl_bvector.h (vector<bool>::swap): Make noexcept
	unconditional.
	* include/bits/stl_deque.h (deque::swap): Likewise.
	(swap(deque&, deque&)): Use _GLIBCXX_NOEXCEPT_IF.
	* include/bits/stl_list.h (list::swap): Make noexcept unconditional.
	(swap(list&, list&)): Use _GLIBCXX_NOEXCEPT_IF.
	* include/bits/stl_map.h (map::swap, swap(map&, map&)): Use
	_GLIBCXX_NOEXCEPT_IF, do not depend on _S_nothrow_swap.
	* include/bits/stl_multimap.h (multimap::swap,
	swap(multimap&, multimap&)): Likewise.
	* include/bits/stl_multiset.h (multiset::swap,
	swap(multiset&, multiset&)): Likewise.
	* include/bits/stl_set.h (set::swap, swap(set&, set&)): Likewise.
	* include/bits/stl_tree.h (_Rb_tree::swap,
	swap(_Rb_tree&, _Rb_tree&)): Likewise.
	* include/bits/stl_vector.h (vector::swap): Make noexcept
	unconditional.
	(swap(vector&, vector&)): Use _GLIBCXX_NOEXCEPT_IF.
	* include/debug/deque (deque::swap, swap): Likewise.
	* include/debug/forward_list (swap): Add noexcept.
	* include/debug/list (list::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
	* include/debug/map.h (map::swap, swap): Likewise.
	* include/debug/multimap.h (multimap::swap, swap): Likewise.
	* include/debug/multiset.h (multiset::Swap, swap): Likewise.
	* include/debug/set.h (set::swap, swap): Likewise.
	* include/debug/unordered_map (unordered_map::swap,
	unordered_multimap::swap, swap): Likewise.
	* include/debug/unordered_set (unordered_set::swap,
	unordered_multiset::swap, swap): Likewise.
	* include/debug/vector (vector::swap, swap): Likewise.
	* include/ext/alloc_traits.h (__alloc_traits::_S_nothrow_swap()):
	Remove.
	* include/profile/deque (deque::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
	* include/profile/forward_list (swap): Add noexcept.
	* include/profile/list (list::swap, swap) : Use _GLIBCXX_NOEXCEPT_IF.
	* include/profile/map.h (map::swap, swap): Likewise.
	* include/profile/multimap.h (multimap::swap, swap): Likewise.
	* include/profile/multiset.h (multiset::swap, swap): Likewise.
	* include/profile/set.h (set::swap, swap): Likewise.
	* include/profile/unordered_map (swap): Likewise.
	* include/profile/unordered_set (swap): Likewise.
	* include/profile/vector (vector::swap, swap): Likewise. Remove
	overloads for swapping rvalues.
	* testsuite/23_containers/deque/allocator/noexcept.cc: Update tests
	for noexcept on swap.
	* testsuite/23_containers/forward_list/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/list/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/map/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/multimap/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/multiset/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/set/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/unordered_map/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/vector/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/vector/bool/allocator/noexcept.cc: Likewise.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error line
	number.

From-SVN: r225744
parent 474d4bbe
2015-07-13 Jonathan Wakely <jwakely@redhat.com>
* include/bits/c++config (_GLIBCXX_NOEXCEPT_IF): Define.
* include/bits/forward_list.h (forward_list::swap): Make noexcept
unconditional.
* include/bits/hashtable.h (_Hashtable::swap): Do not use
_S_nothrow_swap().
* include/bits/stl_bvector.h (vector<bool>::swap): Make noexcept
unconditional.
* include/bits/stl_deque.h (deque::swap): Likewise.
(swap(deque&, deque&)): Use _GLIBCXX_NOEXCEPT_IF.
* include/bits/stl_list.h (list::swap): Make noexcept unconditional.
(swap(list&, list&)): Use _GLIBCXX_NOEXCEPT_IF.
* include/bits/stl_map.h (map::swap, swap(map&, map&)): Use
_GLIBCXX_NOEXCEPT_IF, do not depend on _S_nothrow_swap.
* include/bits/stl_multimap.h (multimap::swap,
swap(multimap&, multimap&)): Likewise.
* include/bits/stl_multiset.h (multiset::swap,
swap(multiset&, multiset&)): Likewise.
* include/bits/stl_set.h (set::swap, swap(set&, set&)): Likewise.
* include/bits/stl_tree.h (_Rb_tree::swap,
swap(_Rb_tree&, _Rb_tree&)): Likewise.
* include/bits/stl_vector.h (vector::swap): Make noexcept
unconditional.
(swap(vector&, vector&)): Use _GLIBCXX_NOEXCEPT_IF.
* include/debug/deque (deque::swap, swap): Likewise.
* include/debug/forward_list (swap): Add noexcept.
* include/debug/list (list::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
* include/debug/map.h (map::swap, swap): Likewise.
* include/debug/multimap.h (multimap::swap, swap): Likewise.
* include/debug/multiset.h (multiset::Swap, swap): Likewise.
* include/debug/set.h (set::swap, swap): Likewise.
* include/debug/unordered_map (unordered_map::swap,
unordered_multimap::swap, swap): Likewise.
* include/debug/unordered_set (unordered_set::swap,
unordered_multiset::swap, swap): Likewise.
* include/debug/vector (vector::swap, swap): Likewise.
* include/ext/alloc_traits.h (__alloc_traits::_S_nothrow_swap()):
Remove.
* include/profile/deque (deque::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
* include/profile/forward_list (swap): Add noexcept.
* include/profile/list (list::swap, swap) : Use _GLIBCXX_NOEXCEPT_IF.
* include/profile/map.h (map::swap, swap): Likewise.
* include/profile/multimap.h (multimap::swap, swap): Likewise.
* include/profile/multiset.h (multiset::swap, swap): Likewise.
* include/profile/set.h (set::swap, swap): Likewise.
* include/profile/unordered_map (swap): Likewise.
* include/profile/unordered_set (swap): Likewise.
* include/profile/vector (vector::swap, swap): Likewise. Remove
overloads for swapping rvalues.
* testsuite/23_containers/deque/allocator/noexcept.cc: Update tests
for noexcept on swap.
* testsuite/23_containers/forward_list/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/list/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/map/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/multimap/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/multiset/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/set/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/unordered_map/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_set/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/vector/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/vector/bool/allocator/noexcept.cc: Likewise.
* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error line
number.
2015-07-13 John Marino <gnugcc@marino.st> 2015-07-13 John Marino <gnugcc@marino.st>
* config/os/bsd/dragonfly/os_defines.h (_GLIBCXX_USE_C99_CHECK, * config/os/bsd/dragonfly/os_defines.h (_GLIBCXX_USE_C99_CHECK,
......
...@@ -115,10 +115,12 @@ ...@@ -115,10 +115,12 @@
#ifndef _GLIBCXX_NOEXCEPT #ifndef _GLIBCXX_NOEXCEPT
# if __cplusplus >= 201103L # if __cplusplus >= 201103L
# define _GLIBCXX_NOEXCEPT noexcept # define _GLIBCXX_NOEXCEPT noexcept
# define _GLIBCXX_NOEXCEPT_IF(_COND) noexcept(_COND)
# define _GLIBCXX_USE_NOEXCEPT noexcept # define _GLIBCXX_USE_NOEXCEPT noexcept
# define _GLIBCXX_THROW(_EXC) # define _GLIBCXX_THROW(_EXC)
# else # else
# define _GLIBCXX_NOEXCEPT # define _GLIBCXX_NOEXCEPT
# define _GLIBCXX_NOEXCEPT_IF(_COND)
# define _GLIBCXX_USE_NOEXCEPT throw() # define _GLIBCXX_USE_NOEXCEPT throw()
# define _GLIBCXX_THROW(_EXC) throw(_EXC) # define _GLIBCXX_THROW(_EXC) throw(_EXC)
# endif # endif
......
...@@ -992,8 +992,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -992,8 +992,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* function. * function.
*/ */
void void
swap(forward_list& __list) swap(forward_list& __list) noexcept
noexcept(_Node_alloc_traits::_S_nothrow_swap())
{ {
std::swap(this->_M_impl._M_head._M_next, std::swap(this->_M_impl._M_head._M_next,
__list._M_impl._M_head._M_next); __list._M_impl._M_head._M_next);
......
...@@ -475,8 +475,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -475,8 +475,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void void
swap(_Hashtable&) swap(_Hashtable&)
noexcept(__node_alloc_traits::_S_nothrow_swap() noexcept(__is_nothrow_swappable<_H1>::value
&& __is_nothrow_swappable<_H1>::value
&& __is_nothrow_swappable<_Equal>::value); && __is_nothrow_swappable<_Equal>::value);
// Basic container operations // Basic container operations
...@@ -1237,8 +1236,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1237,8 +1236,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, _Traits>:: _H1, _H2, _Hash, _RehashPolicy, _Traits>::
swap(_Hashtable& __x) swap(_Hashtable& __x)
noexcept(__node_alloc_traits::_S_nothrow_swap() noexcept(__is_nothrow_swappable<_H1>::value
&& __is_nothrow_swappable<_H1>::value
&& __is_nothrow_swappable<_Equal>::value) && __is_nothrow_swappable<_Equal>::value)
{ {
// The only base class with member variables is hash_code_base. // The only base class with member variables is hash_code_base.
......
...@@ -927,10 +927,7 @@ template<typename _Alloc> ...@@ -927,10 +927,7 @@ template<typename _Alloc>
} }
void void
swap(vector& __x) swap(vector& __x) _GLIBCXX_NOEXCEPT
#if __cplusplus >= 201103L
noexcept(_Bit_alloc_traits::_S_nothrow_swap())
#endif
{ {
std::swap(this->_M_impl._M_start, __x._M_impl._M_start); std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish); std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
......
...@@ -1777,10 +1777,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1777,10 +1777,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* std::swap(d1,d2) will feed to this function. * std::swap(d1,d2) will feed to this function.
*/ */
void void
swap(deque& __x) swap(deque& __x) _GLIBCXX_NOEXCEPT
#if __cplusplus >= 201103L
noexcept(_Alloc_traits::_S_nothrow_swap())
#endif
{ {
_M_impl._M_swap_data(__x._M_impl); _M_impl._M_swap_data(__x._M_impl);
_Alloc_traits::_S_on_swap(_M_get_Tp_allocator(), _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(),
...@@ -2271,9 +2268,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -2271,9 +2268,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y) swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
noexcept(noexcept(__x.swap(__y)))
#endif
{ __x.swap(__y); } { __x.swap(__y); }
#undef _GLIBCXX_DEQUE_BUF_SIZE #undef _GLIBCXX_DEQUE_BUF_SIZE
......
...@@ -1350,10 +1350,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 ...@@ -1350,10 +1350,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
* function. * function.
*/ */
void void
swap(list& __x) swap(list& __x) _GLIBCXX_NOEXCEPT
#if __cplusplus >= 201103L
noexcept(_Node_alloc_traits::_S_nothrow_swap())
#endif
{ {
__detail::_List_node_base::swap(this->_M_impl._M_node, __detail::_List_node_base::swap(this->_M_impl._M_node,
__x._M_impl._M_node); __x._M_impl._M_node);
...@@ -1919,9 +1916,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 ...@@ -1919,9 +1916,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y) swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
noexcept(noexcept(__x.swap(__y)))
#endif
{ __x.swap(__y); } { __x.swap(__y); }
_GLIBCXX_END_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_CONTAINER
......
...@@ -794,10 +794,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -794,10 +794,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/ */
void void
swap(map& __x) swap(map& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value)
noexcept(_Alloc_traits::_S_nothrow_swap()
&& __is_nothrow_swappable<_Compare>::value)
#endif
{ _M_t.swap(__x._M_t); } { _M_t.swap(__x._M_t); }
/** /**
...@@ -1125,9 +1122,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1125,9 +1122,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
inline void inline void
swap(map<_Key, _Tp, _Compare, _Alloc>& __x, swap(map<_Key, _Tp, _Compare, _Alloc>& __x,
map<_Key, _Tp, _Compare, _Alloc>& __y) map<_Key, _Tp, _Compare, _Alloc>& __y)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
noexcept(noexcept(__x.swap(__y)))
#endif
{ __x.swap(__y); } { __x.swap(__y); }
_GLIBCXX_END_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_CONTAINER
......
...@@ -704,10 +704,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -704,10 +704,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/ */
void void
swap(multimap& __x) swap(multimap& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value)
noexcept(_Alloc_traits::_S_nothrow_swap()
&& __is_nothrow_swappable<_Compare>::value)
#endif
{ _M_t.swap(__x._M_t); } { _M_t.swap(__x._M_t); }
/** /**
...@@ -1026,9 +1023,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1026,9 +1023,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
inline void inline void
swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x, swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,
multimap<_Key, _Tp, _Compare, _Alloc>& __y) multimap<_Key, _Tp, _Compare, _Alloc>& __y)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
noexcept(noexcept(__x.swap(__y)))
#endif
{ __x.swap(__y); } { __x.swap(__y); }
_GLIBCXX_END_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_CONTAINER
......
...@@ -406,10 +406,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -406,10 +406,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/ */
void void
swap(multiset& __x) swap(multiset& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value)
noexcept(_Alloc_traits::_S_nothrow_swap()
&& __is_nothrow_swappable<_Compare>::value)
#endif
{ _M_t.swap(__x._M_t); } { _M_t.swap(__x._M_t); }
// insert/erase // insert/erase
...@@ -875,9 +872,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -875,9 +872,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
inline void inline void
swap(multiset<_Key, _Compare, _Alloc>& __x, swap(multiset<_Key, _Compare, _Alloc>& __x,
multiset<_Key, _Compare, _Alloc>& __y) multiset<_Key, _Compare, _Alloc>& __y)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
noexcept(noexcept(__x.swap(__y)))
#endif
{ __x.swap(__y); } { __x.swap(__y); }
_GLIBCXX_END_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_CONTAINER
......
...@@ -410,10 +410,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -410,10 +410,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/ */
void void
swap(set& __x) swap(set& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value)
noexcept(_Alloc_traits::_S_nothrow_swap()
&& __is_nothrow_swappable<_Compare>::value)
#endif
{ _M_t.swap(__x._M_t); } { _M_t.swap(__x._M_t); }
// insert/erase // insert/erase
...@@ -891,9 +888,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -891,9 +888,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Key, typename _Compare, typename _Alloc> template<typename _Key, typename _Compare, typename _Alloc>
inline void inline void
swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y) swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
noexcept(noexcept(__x.swap(__y)))
#endif
{ __x.swap(__y); } { __x.swap(__y); }
_GLIBCXX_END_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_CONTAINER
......
...@@ -920,11 +920,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -920,11 +920,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return _Alloc_traits::max_size(_M_get_Node_allocator()); } { return _Alloc_traits::max_size(_M_get_Node_allocator()); }
void void
#if __cplusplus >= 201103L swap(_Rb_tree& __t)
swap(_Rb_tree& __t) noexcept(_Alloc_traits::_S_nothrow_swap()); _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value);
#else
swap(_Rb_tree& __t);
#endif
// Insert/erase. // Insert/erase.
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
...@@ -1747,10 +1744,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1747,10 +1744,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
void void
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t) swap(_Rb_tree& __t)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value)
noexcept(_Alloc_traits::_S_nothrow_swap())
#endif
{ {
if (_M_root() == 0) if (_M_root() == 0)
{ {
......
...@@ -1190,10 +1190,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1190,10 +1190,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* std::swap(v1,v2) will feed to this function. * std::swap(v1,v2) will feed to this function.
*/ */
void void
swap(vector& __x) swap(vector& __x) _GLIBCXX_NOEXCEPT
#if __cplusplus >= 201103L
noexcept(_Alloc_traits::_S_nothrow_swap())
#endif
{ {
this->_M_impl._M_swap_data(__x._M_impl); this->_M_impl._M_swap_data(__x._M_impl);
_Alloc_traits::_S_on_swap(_M_get_Tp_allocator(), _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(),
...@@ -1556,9 +1553,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1556,9 +1553,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
noexcept(noexcept(__x.swap(__y)))
#endif
{ __x.swap(__y); } { __x.swap(__y); }
_GLIBCXX_END_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_CONTAINER
......
...@@ -588,9 +588,7 @@ namespace __debug ...@@ -588,9 +588,7 @@ namespace __debug
void void
swap(deque& __x) swap(deque& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
_Safe::_M_swap(__x); _Safe::_M_swap(__x);
_Base::swap(__x); _Base::swap(__x);
...@@ -649,6 +647,7 @@ namespace __debug ...@@ -649,6 +647,7 @@ namespace __debug
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs) swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __debug } // namespace __debug
......
...@@ -473,7 +473,7 @@ namespace __debug ...@@ -473,7 +473,7 @@ namespace __debug
void void
swap(forward_list& __list) swap(forward_list& __list)
noexcept( noexcept(declval<_Base>().swap(__list)) ) noexcept( noexcept(declval<_Base&>().swap(__list)) )
{ {
_Safe::_M_swap(__list); _Safe::_M_swap(__list);
_Base::swap(__list); _Base::swap(__list);
...@@ -814,8 +814,8 @@ namespace __debug ...@@ -814,8 +814,8 @@ namespace __debug
/// See std::forward_list::swap(). /// See std::forward_list::swap().
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(forward_list<_Tp, _Alloc>& __lx, swap(forward_list<_Tp, _Alloc>& __lx, forward_list<_Tp, _Alloc>& __ly)
forward_list<_Tp, _Alloc>& __ly) noexcept(noexcept(__lx.swap(__ly)))
{ __lx.swap(__ly); } { __lx.swap(__ly); }
} // namespace __debug } // namespace __debug
......
...@@ -525,9 +525,7 @@ namespace __debug ...@@ -525,9 +525,7 @@ namespace __debug
void void
swap(list& __x) swap(list& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
_Safe::_M_swap(__x); _Safe::_M_swap(__x);
_Base::swap(__x); _Base::swap(__x);
...@@ -808,6 +806,7 @@ namespace __debug ...@@ -808,6 +806,7 @@ namespace __debug
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs) swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __debug } // namespace __debug
......
...@@ -393,9 +393,7 @@ namespace __debug ...@@ -393,9 +393,7 @@ namespace __debug
void void
swap(map& __x) swap(map& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
_Safe::_M_swap(__x); _Safe::_M_swap(__x);
_Base::swap(__x); _Base::swap(__x);
...@@ -589,6 +587,7 @@ namespace __debug ...@@ -589,6 +587,7 @@ namespace __debug
inline void inline void
swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs, swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
map<_Key, _Tp, _Compare, _Allocator>& __rhs) map<_Key, _Tp, _Compare, _Allocator>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __debug } // namespace __debug
......
...@@ -374,9 +374,7 @@ namespace __debug ...@@ -374,9 +374,7 @@ namespace __debug
void void
swap(multimap& __x) swap(multimap& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
_Safe::_M_swap(__x); _Safe::_M_swap(__x);
_Base::swap(__x); _Base::swap(__x);
...@@ -570,6 +568,7 @@ namespace __debug ...@@ -570,6 +568,7 @@ namespace __debug
inline void inline void
swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __debug } // namespace __debug
......
...@@ -361,9 +361,7 @@ namespace __debug ...@@ -361,9 +361,7 @@ namespace __debug
void void
swap(multiset& __x) swap(multiset& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
_Safe::_M_swap(__x); _Safe::_M_swap(__x);
_Base::swap(__x); _Base::swap(__x);
...@@ -550,6 +548,7 @@ namespace __debug ...@@ -550,6 +548,7 @@ namespace __debug
void void
swap(multiset<_Key, _Compare, _Allocator>& __x, swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key, _Compare, _Allocator>& __y) multiset<_Key, _Compare, _Allocator>& __y)
_GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
{ return __x.swap(__y); } { return __x.swap(__y); }
} // namespace __debug } // namespace __debug
......
...@@ -368,9 +368,7 @@ namespace __debug ...@@ -368,9 +368,7 @@ namespace __debug
void void
swap(set& __x) swap(set& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
_Safe::_M_swap(__x); _Safe::_M_swap(__x);
_Base::swap(__x); _Base::swap(__x);
...@@ -557,6 +555,7 @@ namespace __debug ...@@ -557,6 +555,7 @@ namespace __debug
void void
swap(set<_Key, _Compare, _Allocator>& __x, swap(set<_Key, _Compare, _Allocator>& __x,
set<_Key, _Compare, _Allocator>& __y) set<_Key, _Compare, _Allocator>& __y)
_GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
{ return __x.swap(__y); } { return __x.swap(__y); }
} // namespace __debug } // namespace __debug
......
...@@ -185,7 +185,7 @@ namespace __debug ...@@ -185,7 +185,7 @@ namespace __debug
void void
swap(unordered_map& __x) swap(unordered_map& __x)
noexcept( noexcept(declval<_Base>().swap(__x)) ) noexcept( noexcept(declval<_Base&>().swap(__x)) )
{ {
_Safe::_M_swap(__x); _Safe::_M_swap(__x);
_Base::swap(__x); _Base::swap(__x);
...@@ -486,6 +486,7 @@ namespace __debug ...@@ -486,6 +486,7 @@ namespace __debug
inline void inline void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); } { __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Hash, template<typename _Key, typename _Tp, typename _Hash,
...@@ -641,7 +642,7 @@ namespace __debug ...@@ -641,7 +642,7 @@ namespace __debug
void void
swap(unordered_multimap& __x) swap(unordered_multimap& __x)
noexcept( noexcept(declval<_Base>().swap(__x)) ) noexcept( noexcept(declval<_Base&>().swap(__x)) )
{ {
_Safe::_M_swap(__x); _Safe::_M_swap(__x);
_Base::swap(__x); _Base::swap(__x);
...@@ -938,6 +939,7 @@ namespace __debug ...@@ -938,6 +939,7 @@ namespace __debug
inline void inline void
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); } { __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Hash, template<typename _Key, typename _Tp, typename _Hash,
......
...@@ -182,7 +182,7 @@ namespace __debug ...@@ -182,7 +182,7 @@ namespace __debug
void void
swap(unordered_set& __x) swap(unordered_set& __x)
noexcept( noexcept(declval<_Base>().swap(__x)) ) noexcept( noexcept(declval<_Base&>().swap(__x)) )
{ {
_Safe::_M_swap(__x); _Safe::_M_swap(__x);
_Base::swap(__x); _Base::swap(__x);
...@@ -480,6 +480,7 @@ namespace __debug ...@@ -480,6 +480,7 @@ namespace __debug
inline void inline void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); } { __x.swap(__y); }
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
...@@ -634,7 +635,7 @@ namespace __debug ...@@ -634,7 +635,7 @@ namespace __debug
void void
swap(unordered_multiset& __x) swap(unordered_multiset& __x)
noexcept( noexcept(declval<_Base>().swap(__x)) ) noexcept( noexcept(declval<_Base&>().swap(__x)) )
{ {
_Safe::_M_swap(__x); _Safe::_M_swap(__x);
_Base::swap(__x); _Base::swap(__x);
...@@ -920,6 +921,7 @@ namespace __debug ...@@ -920,6 +921,7 @@ namespace __debug
inline void inline void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); } { __x.swap(__y); }
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
......
...@@ -674,9 +674,7 @@ namespace __debug ...@@ -674,9 +674,7 @@ namespace __debug
void void
swap(vector& __x) swap(vector& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
_Safe::_M_swap(__x); _Safe::_M_swap(__x);
_Base::swap(__x); _Base::swap(__x);
...@@ -744,6 +742,7 @@ namespace __debug ...@@ -744,6 +742,7 @@ namespace __debug
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs) swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __debug } // namespace __debug
......
...@@ -112,12 +112,6 @@ template<typename _Alloc> ...@@ -112,12 +112,6 @@ template<typename _Alloc>
static constexpr bool _S_nothrow_move() static constexpr bool _S_nothrow_move()
{ return _S_propagate_on_move_assign() || _S_always_equal(); } { return _S_propagate_on_move_assign() || _S_always_equal(); }
static constexpr bool _S_nothrow_swap()
{
return !_S_propagate_on_swap()
|| std::__is_nothrow_swappable<_Alloc>::value;
}
template<typename _Tp> template<typename _Tp>
struct rebind struct rebind
{ typedef typename _Base_type::template rebind_alloc<_Tp> other; }; { typedef typename _Base_type::template rebind_alloc<_Tp> other; };
......
...@@ -130,9 +130,7 @@ namespace __profile ...@@ -130,9 +130,7 @@ namespace __profile
void void
swap(deque& __x) swap(deque& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ _Base::swap(__x); } { _Base::swap(__x); }
_Base& _Base&
...@@ -181,6 +179,7 @@ namespace __profile ...@@ -181,6 +179,7 @@ namespace __profile
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs) swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __profile } // namespace __profile
......
...@@ -108,7 +108,7 @@ namespace __profile ...@@ -108,7 +108,7 @@ namespace __profile
void void
swap(forward_list& __fl) swap(forward_list& __fl)
noexcept( noexcept(declval<_Base>().swap(__fl)) ) noexcept( noexcept(declval<_Base&>().swap(__fl)) )
{ _Base::swap(__fl); } { _Base::swap(__fl); }
void void
...@@ -208,6 +208,7 @@ namespace __profile ...@@ -208,6 +208,7 @@ namespace __profile
inline void inline void
swap(forward_list<_Tp, _Alloc>& __lx, swap(forward_list<_Tp, _Alloc>& __lx,
forward_list<_Tp, _Alloc>& __ly) forward_list<_Tp, _Alloc>& __ly)
noexcept(noexcept(__lx.swap(__ly)))
{ __lx.swap(__ly); } { __lx.swap(__ly); }
} // namespace __profile } // namespace __profile
......
...@@ -411,9 +411,7 @@ namespace __profile ...@@ -411,9 +411,7 @@ namespace __profile
void void
swap(list& __x) swap(list& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
...@@ -643,6 +641,7 @@ namespace __profile ...@@ -643,6 +641,7 @@ namespace __profile
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs) swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __profile } // namespace __profile
......
...@@ -405,9 +405,7 @@ namespace __profile ...@@ -405,9 +405,7 @@ namespace __profile
void void
swap(map& __x) swap(map& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
...@@ -698,6 +696,7 @@ namespace __profile ...@@ -698,6 +696,7 @@ namespace __profile
inline void inline void
swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs, swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
map<_Key, _Tp, _Compare, _Allocator>& __rhs) map<_Key, _Tp, _Compare, _Allocator>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __profile } // namespace __profile
......
...@@ -364,9 +364,7 @@ namespace __profile ...@@ -364,9 +364,7 @@ namespace __profile
void void
swap(multimap& __x) swap(multimap& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
std::swap(this->_M_map2umap_info, __x._M_map2umap_info); std::swap(this->_M_map2umap_info, __x._M_map2umap_info);
_Base::swap(__x); _Base::swap(__x);
...@@ -656,6 +654,7 @@ namespace __profile ...@@ -656,6 +654,7 @@ namespace __profile
inline void inline void
swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __profile } // namespace __profile
......
...@@ -226,9 +226,7 @@ namespace __profile ...@@ -226,9 +226,7 @@ namespace __profile
void void
swap(multiset& __x) swap(multiset& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
...@@ -640,6 +638,7 @@ namespace __profile ...@@ -640,6 +638,7 @@ namespace __profile
void void
swap(multiset<_Key, _Compare, _Allocator>& __x, swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key, _Compare, _Allocator>& __y) multiset<_Key, _Compare, _Allocator>& __y)
_GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
{ return __x.swap(__y); } { return __x.swap(__y); }
} // namespace __profile } // namespace __profile
......
...@@ -223,9 +223,7 @@ namespace __profile ...@@ -223,9 +223,7 @@ namespace __profile
void void
swap(set& __x) swap(set& __x)
#if __cplusplus >= 201103L _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
...@@ -621,6 +619,7 @@ namespace __profile ...@@ -621,6 +619,7 @@ namespace __profile
void void
swap(set<_Key, _Compare, _Allocator>& __x, swap(set<_Key, _Compare, _Allocator>& __x,
set<_Key, _Compare, _Allocator>& __y) set<_Key, _Compare, _Allocator>& __y)
_GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
{ return __x.swap(__y); } { return __x.swap(__y); }
} // namespace __profile } // namespace __profile
......
...@@ -299,6 +299,7 @@ namespace __profile ...@@ -299,6 +299,7 @@ namespace __profile
inline void inline void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); } { __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Hash, template<typename _Key, typename _Tp, typename _Hash,
...@@ -557,6 +558,7 @@ namespace __profile ...@@ -557,6 +558,7 @@ namespace __profile
inline void inline void
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); } { __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Hash, template<typename _Key, typename _Tp, typename _Hash,
......
...@@ -279,6 +279,7 @@ namespace __profile ...@@ -279,6 +279,7 @@ namespace __profile
inline void inline void
swap(unordered_set<_Key, _Hash, _Pred, _Alloc>& __x, swap(unordered_set<_Key, _Hash, _Pred, _Alloc>& __x,
unordered_set<_Key, _Hash, _Pred, _Alloc>& __y) unordered_set<_Key, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); } { __x.swap(__y); }
template<typename _Key, typename _Hash, typename _Pred, typename _Alloc> template<typename _Key, typename _Hash, typename _Pred, typename _Alloc>
...@@ -534,6 +535,7 @@ namespace __profile ...@@ -534,6 +535,7 @@ namespace __profile
inline void inline void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); } { __x.swap(__y); }
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
......
...@@ -547,20 +547,9 @@ namespace __profile ...@@ -547,20 +547,9 @@ namespace __profile
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs) swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
#if __cplusplus >= 201103L
template<typename _Tp, typename _Alloc>
inline void
swap(vector<_Tp, _Alloc>&& __lhs, vector<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
template<typename _Tp, typename _Alloc>
inline void
swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>&& __rhs)
{ __lhs.swap(__rhs); }
#endif
} // namespace __profile } // namespace __profile
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
......
...@@ -23,15 +23,6 @@ ...@@ -23,15 +23,6 @@
struct T { int i; }; struct T { int i; };
namespace __gnu_test
{
template<typename U>
inline void
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
void test01() void test01()
...@@ -62,6 +53,5 @@ void test03() ...@@ -62,6 +53,5 @@ void test03()
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
// static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); // static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
// noexcept spec of deque::swap depends on swap overload at top of this file static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
} }
...@@ -23,15 +23,6 @@ ...@@ -23,15 +23,6 @@
struct T { int i; }; struct T { int i; };
namespace __gnu_test
{
template<typename U>
inline void
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
void test01() void test01()
...@@ -62,5 +53,5 @@ void test03() ...@@ -62,5 +53,5 @@ void test03()
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
...@@ -23,15 +23,6 @@ ...@@ -23,15 +23,6 @@
struct T { int i; }; struct T { int i; };
namespace __gnu_test
{
template<typename U>
inline void
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
void test01() void test01()
...@@ -62,5 +53,5 @@ void test03() ...@@ -62,5 +53,5 @@ void test03()
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
...@@ -27,16 +27,10 @@ bool operator<(T l, T r) { return l.i < r.i; } ...@@ -27,16 +27,10 @@ bool operator<(T l, T r) { return l.i < r.i; }
using Cmp = std::less<T>; using Cmp = std::less<T>;
struct U { }; struct CmpThrow : Cmp { };
void swap(CmpThrow&, CmpThrow&) noexcept(false) { }
namespace __gnu_test struct U { };
{
template<typename U>
inline void
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
...@@ -53,6 +47,16 @@ void test01() ...@@ -53,6 +47,16 @@ void test01()
void test02() void test02()
{ {
typedef std::allocator<std::pair<const T, U>> alloc_type;
typedef std::map<T, U, CmpThrow, alloc_type> test_type;
test_type v1;
test_type v2;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
}
void test03()
{
typedef propagating_allocator<std::pair<const T, U>, false> alloc_type; typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
typedef std::map<T, U, Cmp, alloc_type> test_type; typedef std::map<T, U, Cmp, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
...@@ -61,12 +65,12 @@ void test02() ...@@ -61,12 +65,12 @@ void test02()
static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
void test03() void test04()
{ {
typedef propagating_allocator<std::pair<const T, U>, true> alloc_type; typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
typedef std::map<T, U, Cmp, alloc_type> test_type; typedef std::map<T, U, Cmp, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
...@@ -27,16 +27,10 @@ bool operator<(T l, T r) { return l.i < r.i; } ...@@ -27,16 +27,10 @@ bool operator<(T l, T r) { return l.i < r.i; }
using Cmp = std::less<T>; using Cmp = std::less<T>;
struct U { }; struct CmpThrow : Cmp { };
void swap(CmpThrow&, CmpThrow&) noexcept(false) { }
namespace __gnu_test struct U { };
{
template<typename U>
inline void
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
...@@ -53,20 +47,20 @@ void test01() ...@@ -53,20 +47,20 @@ void test01()
void test02() void test02()
{ {
typedef propagating_allocator<std::pair<const T, U>, false> alloc_type; typedef std::allocator<std::pair<const T, U>> alloc_type;
typedef std::multimap<T, U, Cmp, alloc_type> test_type; typedef std::multimap<T, U, CmpThrow, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1;
test_type v2(alloc_type(2)); test_type v2;
static_assert( !noexcept( v1 = std::move(v2) ), "Move assign can throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
} }
void test03() void test03()
{ {
typedef propagating_allocator<std::pair<const T, U>, true> alloc_type; typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
typedef std::multimap<T, U, Cmp, alloc_type> test_type; typedef std::multimap<T, U, Cmp, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( !noexcept( v1 = std::move(v2) ), "Move assign can throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
...@@ -28,14 +28,8 @@ bool operator<(T l, T r) { return l.i < r.i; } ...@@ -28,14 +28,8 @@ bool operator<(T l, T r) { return l.i < r.i; }
using Cmp = std::less<T>; using Cmp = std::less<T>;
namespace __gnu_test struct CmpThrow : Cmp { };
{ void swap(CmpThrow&, CmpThrow&) noexcept(false) { }
template<typename U>
inline void
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
...@@ -52,6 +46,16 @@ void test01() ...@@ -52,6 +46,16 @@ void test01()
void test02() void test02()
{ {
typedef std::allocator<T> alloc_type;
typedef std::multiset<T, CmpThrow, alloc_type> test_type;
test_type v1;
test_type v2;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
}
void test03()
{
typedef propagating_allocator<T, false> alloc_type; typedef propagating_allocator<T, false> alloc_type;
typedef std::multiset<T, Cmp, alloc_type> test_type; typedef std::multiset<T, Cmp, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
...@@ -60,12 +64,12 @@ void test02() ...@@ -60,12 +64,12 @@ void test02()
static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
void test03() void test04()
{ {
typedef propagating_allocator<T, true> alloc_type; typedef propagating_allocator<T, true> alloc_type;
typedef std::multiset<T, Cmp, alloc_type> test_type; typedef std::multiset<T, Cmp, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
...@@ -27,14 +27,8 @@ bool operator<(T l, T r) { return l.i < r.i; } ...@@ -27,14 +27,8 @@ bool operator<(T l, T r) { return l.i < r.i; }
using Cmp = std::less<T>; using Cmp = std::less<T>;
namespace __gnu_test struct CmpThrow : Cmp { };
{ void swap(CmpThrow&, CmpThrow&) noexcept(false) { }
template<typename U>
inline void
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
...@@ -51,6 +45,16 @@ void test01() ...@@ -51,6 +45,16 @@ void test01()
void test02() void test02()
{ {
typedef std::allocator<T> alloc_type;
typedef std::set<T, CmpThrow, alloc_type> test_type;
test_type v1;
test_type v2;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
}
void test03()
{
typedef propagating_allocator<T, false> alloc_type; typedef propagating_allocator<T, false> alloc_type;
typedef std::set<T, Cmp, alloc_type> test_type; typedef std::set<T, Cmp, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
...@@ -59,12 +63,12 @@ void test02() ...@@ -59,12 +63,12 @@ void test02()
static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
void test03() void test04()
{ {
typedef propagating_allocator<T, true> alloc_type; typedef propagating_allocator<T, true> alloc_type;
typedef std::set<T, Cmp, alloc_type> test_type; typedef std::set<T, Cmp, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
...@@ -35,14 +35,11 @@ struct equal_to ...@@ -35,14 +35,11 @@ struct equal_to
{ return lhs.i == rhs.i; } { return lhs.i == rhs.i; }
}; };
namespace __gnu_test // Versions of the function objects without nothrow swap.
{ struct hash_t : hash { };
template<typename U> void swap(hash_t&, hash_t&) noexcept(false) { }
inline void struct equal_to_t : equal_to { };
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r) void swap(equal_to_t&, equal_to_t&) noexcept(false) { }
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
...@@ -59,6 +56,26 @@ void test01() ...@@ -59,6 +56,26 @@ void test01()
void test02() void test02()
{ {
typedef std::allocator<T> alloc_type;
typedef std::unordered_map<T, T, hash_t, equal_to, alloc_type> test_type;
test_type v1;
test_type v2;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
}
void test03()
{
typedef std::allocator<T> alloc_type;
typedef std::unordered_map<T, T, hash, equal_to_t, alloc_type> test_type;
test_type v1;
test_type v2;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
}
void test04()
{
typedef propagating_allocator<T, false> alloc_type; typedef propagating_allocator<T, false> alloc_type;
typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type; typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
...@@ -67,19 +84,19 @@ void test02() ...@@ -67,19 +84,19 @@ void test02()
static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
void test03() void test05()
{ {
typedef propagating_allocator<T, true> alloc_type; typedef propagating_allocator<T, true> alloc_type;
typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type; typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
void test04() void test06()
{ {
typedef std::unordered_map<int, int> test_type; typedef std::unordered_map<int, int> test_type;
static_assert( noexcept( test_type() ), "Default constructor do not throw" ); static_assert( noexcept( test_type() ), "Default constructor does not throw" );
static_assert( noexcept( test_type(test_type()) ), "Move constructor do not throw" ); static_assert( noexcept( test_type(test_type()) ), "Move constructor does not throw" );
} }
...@@ -35,14 +35,11 @@ struct equal_to ...@@ -35,14 +35,11 @@ struct equal_to
{ return lhs.i == rhs.i; } { return lhs.i == rhs.i; }
}; };
namespace __gnu_test // Versions of the function objects without nothrow swap.
{ struct hash_t : hash { };
template<typename U> void swap(hash_t&, hash_t&) noexcept(false) { }
inline void struct equal_to_t : equal_to { };
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r) void swap(equal_to_t&, equal_to_t&) noexcept(false) { }
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
...@@ -59,6 +56,27 @@ void test01() ...@@ -59,6 +56,27 @@ void test01()
void test02() void test02()
{ {
typedef std::allocator<T> alloc_type;
typedef std::unordered_multimap<T, T, hash_t, equal_to, alloc_type> test_type;
test_type v1;
test_type v2;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
}
void test03()
{
typedef std::allocator<T> alloc_type;
typedef std::unordered_multimap<T, T, hash, equal_to_t, alloc_type>
test_type;
test_type v1;
test_type v2;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
}
void test04()
{
typedef propagating_allocator<T, false> alloc_type; typedef propagating_allocator<T, false> alloc_type;
typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type; typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
...@@ -67,19 +85,19 @@ void test02() ...@@ -67,19 +85,19 @@ void test02()
static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
void test03() void test05()
{ {
typedef propagating_allocator<T, true> alloc_type; typedef propagating_allocator<T, true> alloc_type;
typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type; typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
void test04() void test06()
{ {
typedef std::unordered_multimap<int, int> test_type; typedef std::unordered_multimap<int, int> test_type;
static_assert( noexcept( test_type() ), "Default constructor do not throw" ); static_assert( noexcept( test_type() ), "Default constructor does not throw" );
static_assert( noexcept( test_type(test_type()) ), "Move constructor do not throw" ); static_assert( noexcept( test_type(test_type()) ), "Move constructor does not throw" );
} }
...@@ -35,14 +35,11 @@ struct equal_to ...@@ -35,14 +35,11 @@ struct equal_to
{ return lhs.i == rhs.i; } { return lhs.i == rhs.i; }
}; };
namespace __gnu_test // Versions of the function objects without nothrow swap.
{ struct hash_t : hash { };
template<typename U> void swap(hash_t&, hash_t&) noexcept(false) { }
inline void struct equal_to_t : equal_to { };
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r) void swap(equal_to_t&, equal_to_t&) noexcept(false) { }
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
...@@ -59,6 +56,26 @@ void test01() ...@@ -59,6 +56,26 @@ void test01()
void test02() void test02()
{ {
typedef std::allocator<T> alloc_type;
typedef std::unordered_multiset<T, hash_t, equal_to, alloc_type> test_type;
test_type v1;
test_type v2;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
}
void test03()
{
typedef std::allocator<T> alloc_type;
typedef std::unordered_multiset<T, hash, equal_to_t, alloc_type> test_type;
test_type v1;
test_type v2;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
}
void test04()
{
typedef propagating_allocator<T, false> alloc_type; typedef propagating_allocator<T, false> alloc_type;
typedef std::unordered_multiset<T, hash, equal_to, alloc_type> test_type; typedef std::unordered_multiset<T, hash, equal_to, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
...@@ -67,19 +84,19 @@ void test02() ...@@ -67,19 +84,19 @@ void test02()
static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
void test03() void test05()
{ {
typedef propagating_allocator<T, true> alloc_type; typedef propagating_allocator<T, true> alloc_type;
typedef std::unordered_multiset<T, hash, equal_to, alloc_type> test_type; typedef std::unordered_multiset<T, hash, equal_to, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
void test04() void test06()
{ {
typedef std::unordered_multiset<int> test_type; typedef std::unordered_multiset<int> test_type;
static_assert( noexcept( test_type() ), "Default constructor do not throw" ); static_assert( noexcept( test_type() ), "Default constructor does not throw" );
static_assert( noexcept( test_type(test_type()) ), "Move constructor do not throw" ); static_assert( noexcept( test_type(test_type()) ), "Move constructor does not throw" );
} }
...@@ -35,14 +35,11 @@ struct equal_to ...@@ -35,14 +35,11 @@ struct equal_to
{ return lhs.i == rhs.i; } { return lhs.i == rhs.i; }
}; };
namespace __gnu_test // Versions of the function objects without nothrow swap.
{ struct hash_t : hash { };
template<typename U> void swap(hash_t&, hash_t&) noexcept(false) { }
inline void struct equal_to_t : equal_to { };
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r) void swap(equal_to_t&, equal_to_t&) noexcept(false) { }
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
...@@ -59,6 +56,26 @@ void test01() ...@@ -59,6 +56,26 @@ void test01()
void test02() void test02()
{ {
typedef std::allocator<T> alloc_type;
typedef std::unordered_set<T, hash_t, equal_to, alloc_type> test_type;
test_type v1;
test_type v2;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
}
void test03()
{
typedef std::allocator<T> alloc_type;
typedef std::unordered_set<T, hash, equal_to_t, alloc_type> test_type;
test_type v1;
test_type v2;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
}
void test04()
{
typedef propagating_allocator<T, false> alloc_type; typedef propagating_allocator<T, false> alloc_type;
typedef std::unordered_set<T, hash, equal_to, alloc_type> test_type; typedef std::unordered_set<T, hash, equal_to, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
...@@ -67,19 +84,19 @@ void test02() ...@@ -67,19 +84,19 @@ void test02()
static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
void test03() void test05()
{ {
typedef propagating_allocator<T, true> alloc_type; typedef propagating_allocator<T, true> alloc_type;
typedef std::unordered_set<T, hash, equal_to, alloc_type> test_type; typedef std::unordered_set<T, hash, equal_to, alloc_type> test_type;
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
void test04() void test06()
{ {
typedef std::unordered_set<int> test_type; typedef std::unordered_set<int> test_type;
static_assert( noexcept( test_type() ), "Default constructor do not throw" ); static_assert( noexcept( test_type() ), "Default constructor does not throw" );
static_assert( noexcept( test_type(test_type()) ), "Move constructor do not throw" ); static_assert( noexcept( test_type(test_type()) ), "Move constructor does not throw" );
} }
...@@ -23,15 +23,6 @@ ...@@ -23,15 +23,6 @@
struct T { int i; }; struct T { int i; };
namespace __gnu_test
{
template<typename U>
inline void
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
void test01() void test01()
...@@ -62,5 +53,5 @@ void test03() ...@@ -62,5 +53,5 @@ void test03()
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
...@@ -23,15 +23,6 @@ ...@@ -23,15 +23,6 @@
using T = bool; using T = bool;
namespace __gnu_test
{
template<typename U>
inline void
swap(propagating_allocator<U, true>& l, propagating_allocator<U, true>& r)
noexcept(false)
{ }
}
using __gnu_test::propagating_allocator; using __gnu_test::propagating_allocator;
void test01() void test01()
...@@ -62,5 +53,5 @@ void test03() ...@@ -62,5 +53,5 @@ void test03()
test_type v1(alloc_type(1)); test_type v1(alloc_type(1));
test_type v2(alloc_type(2)); test_type v2(alloc_type(2));
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" ); static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <vector> #include <vector>
// { dg-error "multiple inlined namespaces" "" { target *-*-* } 322 } // { dg-error "multiple inlined namespaces" "" { target *-*-* } 324 }
// "template argument 1 is invalid" // "template argument 1 is invalid"
// { dg-prune-output "tuple:993" } // { dg-prune-output "tuple:993" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment