Commit ff74fd13 by Jonathan Wakely Committed by Jonathan Wakely

stl_pair.h (swap): Do not swap rvalues.

2009-05-18  Jonathan Wakely  <jwakely.gcc@gmail.com>

	* include/bits/stl_pair.h (swap): Do not swap rvalues.
	* include/bits/stl_deque.h (swap): Likewise.
	* include/bits/stl_list.h (swap): Likewise.
	* include/bits/stl_vector.h (swap): Likewise.
	* include/bits/stl_bvector.h (swap): Likewise.
	* include/bits/stl_queue.h (swap): Likewise.
	* include/bits/stl_stack.h (swap): Likewise.
	* include/bits/stl_tree.h (swap): Likewise.
	* include/bits/stl_map.h (swap): Likewise.
	* include/bits/stl_multimap.h (swap): Likewise.
	* include/bits/stl_set.h (swap): Likewise.
	* include/bits/stl_multiset.h (swap): Likewise.
	* include/bits/forward_list.h (swap): Likewise.
	* include/bits/unique_ptr.h (swap): Likewise.
	* include/debug/deque (swap): Likewise.
	* include/debug/list (swap): Likewise.
	* include/debug/vector (swap): Likewise.
	* include/debug/map.h (swap): Likewise.
	* include/debug/multimap.h (swap): Likewise.
	* include/debug/set.h (swap): Likewise.
	* include/debug/multiset.h (swap): Likewise.
	* include/debug/unordered_map (swap): Likewise.
	* include/debug/unordered_set (swap): Likewise.
	* include/ext/vstring.h (swap): Likewise.
	* include/tr1_impl/unordered_map (swap): Likewise.
	* include/tr1_impl/hashtable (swap): Likewise.
	* include/tr1_impl/unordered_set (swap): Likewise.
	* include/std/tuple (swap): Likewise.
	* include/std/mutex (swap): Likewise.
	* include/std/thread (swap): Likewise.
	(operator<<): Only output to lvalue streams.
	* testsuite/20_util/shared_ptr/modifiers/swap_rvalue.cc: Remove.
	* testsuite/23_containers/headers/forward_list/synopsis.cc: Adjust.
	* testsuite/23_containers/deque/requirements/dr438/
	assign_neg.cc: Adjust line numbers.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	insert_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	assign_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	insert_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	assign_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	insert_neg.cc: Likewise.
	* testsuite/30_threads/thread/swap/1.cc: Swap with lvalue and also
	test non-member swap.
	* testsuite/30_threads/thread/swap/2.cc: Remove.

From-SVN: r147678
parent e57d93c6
2009-05-13 Jonathan Wakely <jwakely.gcc@gmail.com>
2009-05-18 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/bits/stl_pair.h (swap): Do not swap rvalues.
* include/bits/stl_deque.h (swap): Likewise.
* include/bits/stl_list.h (swap): Likewise.
* include/bits/stl_vector.h (swap): Likewise.
* include/bits/stl_bvector.h (swap): Likewise.
* include/bits/stl_queue.h (swap): Likewise.
* include/bits/stl_stack.h (swap): Likewise.
* include/bits/stl_tree.h (swap): Likewise.
* include/bits/stl_map.h (swap): Likewise.
* include/bits/stl_multimap.h (swap): Likewise.
* include/bits/stl_set.h (swap): Likewise.
* include/bits/stl_multiset.h (swap): Likewise.
* include/bits/forward_list.h (swap): Likewise.
* include/bits/unique_ptr.h (swap): Likewise.
* include/debug/deque (swap): Likewise.
* include/debug/list (swap): Likewise.
* include/debug/vector (swap): Likewise.
* include/debug/map.h (swap): Likewise.
* include/debug/multimap.h (swap): Likewise.
* include/debug/set.h (swap): Likewise.
* include/debug/multiset.h (swap): Likewise.
* include/debug/unordered_map (swap): Likewise.
* include/debug/unordered_set (swap): Likewise.
* include/ext/vstring.h (swap): Likewise.
* include/tr1_impl/unordered_map (swap): Likewise.
* include/tr1_impl/hashtable (swap): Likewise.
* include/tr1_impl/unordered_set (swap): Likewise.
* include/std/tuple (swap): Likewise.
* include/std/mutex (swap): Likewise.
* include/std/thread (swap): Likewise.
(operator<<): Only output to lvalue streams.
* testsuite/20_util/shared_ptr/modifiers/swap_rvalue.cc: Remove.
* testsuite/23_containers/headers/forward_list/synopsis.cc: Adjust.
* testsuite/23_containers/deque/requirements/dr438/
assign_neg.cc: Adjust line numbers.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
insert_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
assign_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
insert_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
assign_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
insert_neg.cc: Likewise.
* testsuite/30_threads/thread/swap/1.cc: Swap with lvalue and also
test non-member swap.
* testsuite/30_threads/thread/swap/2.cc: Remove.
2009-05-16 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/std/mutex: Move std::lock_error to ...
* src/compatibility.cc: Here.
......
......@@ -983,7 +983,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* function.
*/
void
swap(forward_list&& __list)
swap(forward_list& __list)
{ _Node_base::swap(this->_M_impl._M_head, __list._M_impl._M_head); }
/**
......@@ -1285,20 +1285,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
forward_list<_Tp, _Alloc>& __ly)
{ __lx.swap(__ly); }
/// See std::forward_list::swap().
template<typename _Tp, typename _Alloc>
inline void
swap(forward_list<_Tp, _Alloc>&& __lx,
forward_list<_Tp, _Alloc>& __ly)
{ __lx.swap(__ly); }
/// See std::forward_list::swap().
template<typename _Tp, typename _Alloc>
inline void
swap(forward_list<_Tp, _Alloc>& __lx,
forward_list<_Tp, _Alloc>&& __ly)
{ __lx.swap(__ly); }
_GLIBCXX_END_NAMESPACE // namespace std
#endif // __GXX_EXPERIMENTAL_CXX0X__
......
......@@ -743,11 +743,7 @@ template<typename _Alloc>
}
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(vector&& __x)
#else
swap(vector& __x)
#endif
{
std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
......
......@@ -1395,11 +1395,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* std::swap(d1,d2) will feed to this function.
*/
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(deque&& __x)
#else
swap(deque& __x)
#endif
{
std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
......@@ -1802,18 +1798,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y)
{ __x.swap(__y); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Tp, typename _Alloc>
inline void
swap(deque<_Tp,_Alloc>&& __x, deque<_Tp,_Alloc>& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Alloc>
inline void
swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>&& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NESTED_NAMESPACE
#endif /* _STL_DEQUE_H */
......@@ -1106,11 +1106,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* function.
*/
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(list&& __x)
#else
swap(list& __x)
#endif
{
_List_node_base::swap(this->_M_impl._M_node, __x._M_impl._M_node);
......@@ -1516,18 +1512,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
{ __x.swap(__y); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Tp, typename _Alloc>
inline void
swap(list<_Tp, _Alloc>&& __x, list<_Tp, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Alloc>
inline void
swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>&& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NESTED_NAMESPACE
#endif /* _STL_LIST_H */
......@@ -608,11 +608,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* that std::swap(m1,m2) will feed to this function.
*/
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(map&& __x)
#else
swap(map& __x)
#endif
{ _M_t.swap(__x._M_t); }
/**
......@@ -852,20 +848,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
map<_Key, _Tp, _Compare, _Alloc>& __y)
{ __x.swap(__y); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline void
swap(map<_Key, _Tp, _Compare, _Alloc>&& __x,
map<_Key, _Tp, _Compare, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline void
swap(map<_Key, _Tp, _Compare, _Alloc>& __x,
map<_Key, _Tp, _Compare, _Alloc>&& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NESTED_NAMESPACE
#endif /* _STL_MAP_H */
......@@ -544,11 +544,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* std::swap(m1,m2) will feed to this function.
*/
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(multimap&& __x)
#else
swap(multimap& __x)
#endif
{ _M_t.swap(__x._M_t); }
/**
......@@ -781,20 +777,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
multimap<_Key, _Tp, _Compare, _Alloc>& __y)
{ __x.swap(__y); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline void
swap(multimap<_Key, _Tp, _Compare, _Alloc>&& __x,
multimap<_Key, _Tp, _Compare, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline void
swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,
multimap<_Key, _Tp, _Compare, _Alloc>&& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NESTED_NAMESPACE
#endif /* _STL_MULTIMAP_H */
......@@ -376,11 +376,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* std::swap(s1,s2) will feed to this function.
*/
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(multiset&& __x)
#else
swap(multiset& __x)
#endif
{ _M_t.swap(__x._M_t); }
// insert/erase
......@@ -678,20 +674,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
multiset<_Key, _Compare, _Alloc>& __y)
{ __x.swap(__y); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Key, typename _Compare, typename _Alloc>
inline void
swap(multiset<_Key, _Compare, _Alloc>&& __x,
multiset<_Key, _Compare, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Key, typename _Compare, typename _Alloc>
inline void
swap(multiset<_Key, _Compare, _Alloc>& __x,
multiset<_Key, _Compare, _Alloc>&& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NESTED_NAMESPACE
#endif /* _STL_MULTISET_H */
......@@ -131,7 +131,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
void
swap(pair&& __p)
swap(pair& __p)
{
using std::swap;
swap(first, __p.first);
......@@ -185,16 +185,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
inline void
swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
{ __x.swap(__y); }
template<class _T1, class _T2>
inline void
swap(pair<_T1, _T2>&& __x, pair<_T1, _T2>& __y)
{ __x.swap(__y); }
template<class _T1, class _T2>
inline void
swap(pair<_T1, _T2>& __x, pair<_T1, _T2>&& __y)
{ __x.swap(__y); }
#endif
/**
......
......@@ -249,7 +249,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void
swap(queue&& __q)
swap(queue& __q)
{ c.swap(__q.c); }
#endif
};
......@@ -317,16 +317,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
inline void
swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Seq>
inline void
swap(queue<_Tp, _Seq>&& __x, queue<_Tp, _Seq>& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Seq>
inline void
swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>&& __y)
{ __x.swap(__y); }
#endif
/**
......@@ -550,7 +540,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void
swap(priority_queue&& __pq)
swap(priority_queue& __pq)
{
using std::swap;
c.swap(__pq.c);
......@@ -567,18 +557,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
swap(priority_queue<_Tp, _Sequence, _Compare>& __x,
priority_queue<_Tp, _Sequence, _Compare>& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Sequence, typename _Compare>
inline void
swap(priority_queue<_Tp, _Sequence, _Compare>&& __x,
priority_queue<_Tp, _Sequence, _Compare>& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Sequence, typename _Compare>
inline void
swap(priority_queue<_Tp, _Sequence, _Compare>& __x,
priority_queue<_Tp, _Sequence, _Compare>&& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NAMESPACE
......
......@@ -383,11 +383,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* std::swap(s1,s2) will feed to this function.
*/
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(set&& __x)
#else
swap(set& __x)
#endif
{ _M_t.swap(__x._M_t); }
// insert/erase
......@@ -691,18 +687,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y)
{ __x.swap(__y); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Key, typename _Compare, typename _Alloc>
inline void
swap(set<_Key, _Compare, _Alloc>&& __x, set<_Key, _Compare, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Key, typename _Compare, typename _Alloc>
inline void
swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>&& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NESTED_NAMESPACE
#endif /* _STL_SET_H */
......@@ -213,7 +213,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void
swap(stack&& __s)
swap(stack& __s)
{ c.swap(__s.c); }
#endif
};
......@@ -282,16 +282,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
inline void
swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Seq>
inline void
swap(stack<_Tp, _Seq>&& __x, stack<_Tp, _Seq>& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Seq>
inline void
swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>&& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NAMESPACE
......
......@@ -675,11 +675,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return _M_get_Node_allocator().max_size(); }
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(_Rb_tree&& __t);
#else
swap(_Rb_tree& __t);
#endif
// Insert/erase.
pair<iterator, bool>
......@@ -1104,11 +1100,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typename _Compare, typename _Alloc>
void
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&& __t)
#else
swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t)
#endif
{
if (_M_root() == 0)
{
......
......@@ -923,11 +923,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* std::swap(v1,v2) will feed to this function.
*/
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(vector&& __x)
#else
swap(vector& __x)
#endif
{
std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
......@@ -1216,18 +1212,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)
{ __x.swap(__y); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Tp, typename _Alloc>
inline void
swap(vector<_Tp, _Alloc>&& __x, vector<_Tp, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Alloc>
inline void
swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>&& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NESTED_NAMESPACE
#endif /* _STL_VECTOR_H */
......@@ -204,7 +204,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
void
swap(unique_ptr&& __u)
swap(unique_ptr& __u)
{
using std::swap;
swap(_M_t, __u._M_t);
......@@ -350,7 +350,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
void reset(_Up) = delete;
void
swap(unique_ptr&& __u)
swap(unique_ptr& __u)
{
using std::swap;
swap(_M_t, __u._M_t);
......@@ -389,18 +389,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
unique_ptr<_Tp, _Tp_Deleter>& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Tp_Deleter>
inline void
swap(unique_ptr<_Tp, _Tp_Deleter>&& __x,
unique_ptr<_Tp, _Tp_Deleter>& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Tp_Deleter>
inline void
swap(unique_ptr<_Tp, _Tp_Deleter>& __x,
unique_ptr<_Tp, _Tp_Deleter>&& __y)
{ __x.swap(__y); }
template<typename _Tp, typename _Tp_Deleter,
typename _Up, typename _Up_Deleter>
inline bool
......
......@@ -432,11 +432,7 @@ namespace __debug
}
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(deque&& __x)
#else
swap(deque& __x)
#endif
{
_Base::swap(__x);
this->_M_swap(__x);
......@@ -497,18 +493,6 @@ namespace __debug
swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Tp, typename _Alloc>
inline void
swap(deque<_Tp, _Alloc>&& __lhs, deque<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
template<typename _Tp, typename _Alloc>
inline void
swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>&& __rhs)
{ __lhs.swap(__rhs); }
#endif
} // namespace __debug
} // namespace std
......
......@@ -367,11 +367,7 @@ namespace __debug
}
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(list&& __x)
#else
swap(list& __x)
#endif
{
_Base::swap(__x);
this->_M_swap(__x);
......@@ -635,18 +631,6 @@ namespace __debug
swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Tp, typename _Alloc>
inline void
swap(list<_Tp, _Alloc>&& __lhs, list<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
template<typename _Tp, typename _Alloc>
inline void
swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>&& __rhs)
{ __lhs.swap(__rhs); }
#endif
} // namespace __debug
} // namespace std
......
......@@ -260,11 +260,7 @@ namespace __debug
}
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(map&& __x)
#else
swap(map& __x)
#endif
{
_Base::swap(__x);
this->_M_swap(__x);
......@@ -390,22 +386,6 @@ namespace __debug
map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ __lhs.swap(__rhs); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline void
swap(map<_Key, _Tp, _Compare, _Allocator>&& __lhs,
map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ __lhs.swap(__rhs); }
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline void
swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
map<_Key, _Tp, _Compare, _Allocator>&& __rhs)
{ __lhs.swap(__rhs); }
#endif
} // namespace __debug
} // namespace std
......
......@@ -248,11 +248,7 @@ namespace __debug
}
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(multimap&& __x)
#else
swap(multimap& __x)
#endif
{
_Base::swap(__x);
this->_M_swap(__x);
......@@ -378,22 +374,6 @@ namespace __debug
multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ __lhs.swap(__rhs); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline void
swap(multimap<_Key, _Tp, _Compare, _Allocator>&& __lhs,
multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ __lhs.swap(__rhs); }
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline void
swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
multimap<_Key, _Tp, _Compare, _Allocator>&& __rhs)
{ __lhs.swap(__rhs); }
#endif
} // namespace __debug
} // namespace std
......
......@@ -245,11 +245,7 @@ namespace __debug
}
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(multiset&& __x)
#else
swap(multiset& __x)
#endif
{
_Base::swap(__x);
this->_M_swap(__x);
......@@ -376,20 +372,6 @@ namespace __debug
multiset<_Key, _Compare, _Allocator>& __y)
{ return __x.swap(__y); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Key, typename _Compare, typename _Allocator>
void
swap(multiset<_Key, _Compare, _Allocator>&& __x,
multiset<_Key, _Compare, _Allocator>& __y)
{ return __x.swap(__y); }
template<typename _Key, typename _Compare, typename _Allocator>
void
swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key, _Compare, _Allocator>&& __y)
{ return __x.swap(__y); }
#endif
} // namespace __debug
} // namespace std
......
......@@ -250,11 +250,7 @@ namespace __debug
}
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(set&& __x)
#else
swap(set& __x)
#endif
{
_Base::swap(__x);
this->_M_swap(__x);
......@@ -381,20 +377,6 @@ namespace __debug
set<_Key, _Compare, _Allocator>& __y)
{ return __x.swap(__y); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Key, typename _Compare, typename _Allocator>
void
swap(set<_Key, _Compare, _Allocator>&& __x,
set<_Key, _Compare, _Allocator>& __y)
{ return __x.swap(__y); }
template<typename _Key, typename _Compare, typename _Allocator>
void
swap(set<_Key, _Compare, _Allocator>& __x,
set<_Key, _Compare, _Allocator>&& __y)
{ return __x.swap(__y); }
#endif
} // namespace __debug
} // namespace std
......
......@@ -129,7 +129,7 @@ namespace __debug
}
void
swap(unordered_map&& __x)
swap(unordered_map& __x)
{
_Base::swap(__x);
_Safe_base::_M_swap(__x);
......@@ -314,20 +314,6 @@ namespace __debug
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
{ __x.swap(__y); }
template<typename _Key, typename _Tp,
typename _Hash = std::hash<_Key>,
......@@ -415,7 +401,7 @@ namespace __debug
}
void
swap(unordered_multimap&& __x)
swap(unordered_multimap& __x)
{
_Base::swap(__x);
_Safe_base::_M_swap(__x);
......@@ -588,20 +574,6 @@ namespace __debug
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline void
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline void
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
{ __x.swap(__y); }
} // namespace __debug
} // namespace std
......
......@@ -129,7 +129,7 @@ namespace __debug
}
void
swap(unordered_set&& __x)
swap(unordered_set& __x)
{
_Base::swap(__x);
_Safe_base::_M_swap(__x);
......@@ -313,18 +313,6 @@ namespace __debug
unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
inline void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>&& __x,
unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
inline void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_set<_Value, _Hash, _Pred, _Alloc>&& __y)
{ __x.swap(__y); }
template<typename _Value,
typename _Hash = std::hash<_Value>,
......@@ -411,7 +399,7 @@ namespace __debug
}
void
swap(unordered_multiset&& __x)
swap(unordered_multiset& __x)
{
_Base::swap(__x);
_Safe_base::_M_swap(__x);
......@@ -583,18 +571,6 @@ namespace __debug
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
inline void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __x,
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
inline void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __y)
{ __x.swap(__y); }
} // namespace __debug
} // namespace std
......
......@@ -452,11 +452,7 @@ namespace __debug
}
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(vector&& __x)
#else
swap(vector& __x)
#endif
{
_Base::swap(__x);
this->_M_swap(__x);
......@@ -533,18 +529,6 @@ namespace __debug
swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
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 __debug
} // namespace std
......
......@@ -1439,11 +1439,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
* constant time.
*/
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(__versa_string&& __s)
#else
swap(__versa_string& __s)
#endif
{ this->_M_swap(__s); }
// String operations:
......@@ -2335,22 +2331,6 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ __lhs.swap(__rhs); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline void
swap(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
__versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ __lhs.swap(__rhs); }
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline void
swap(__versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
__versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
{ __lhs.swap(__rhs); }
#endif
_GLIBCXX_END_NAMESPACE
_GLIBCXX_BEGIN_NAMESPACE(std)
......
......@@ -555,7 +555,7 @@ namespace std
}
void
swap(unique_lock&& __u)
swap(unique_lock& __u)
{
std::swap(_M_device, __u._M_device);
std::swap(_M_owns, __u._M_owns);
......@@ -591,16 +591,6 @@ namespace std
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y)
{ __x.swap(__y); }
template<typename _Mutex>
inline void
swap(unique_lock<_Mutex>&& __x, unique_lock<_Mutex>& __y)
{ __x.swap(__y); }
template<typename _Mutex>
inline void
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>&& __y)
{ __x.swap(__y); }
template<int _Idx>
struct __unlock_impl
{
......
......@@ -88,7 +88,7 @@ namespace std
template<class _CharT, class _Traits>
friend basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>&& __out, thread::id __id);
operator<<(basic_ostream<_CharT, _Traits>& __out, thread::id __id);
};
// Simple base type that the templatized, derived class containing
......@@ -149,7 +149,7 @@ namespace std
}
void
swap(thread&& __t)
swap(thread& __t)
{ std::swap(_M_id, __t._M_id); }
bool
......@@ -194,14 +194,6 @@ namespace std
swap(thread& __x, thread& __y)
{ __x.swap(__y); }
inline void
swap(thread&& __x, thread& __y)
{ __x.swap(__y); }
inline void
swap(thread& __x, thread&& __y)
{ __x.swap(__y); }
inline bool
operator!=(thread::id __x, thread::id __y)
{ return !(__x == __y); }
......@@ -220,7 +212,7 @@ namespace std
template<class _CharT, class _Traits>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>&& __out, thread::id __id)
operator<<(basic_ostream<_CharT, _Traits>& __out, thread::id __id)
{
if (__id == thread::id())
return __out << "thread::id of a non-executing thread";
......
......@@ -77,7 +77,7 @@ namespace std
_Head& _M_head() { return *this; }
const _Head& _M_head() const { return *this; }
void _M_swap_impl(_Head&&) { /* no-op */ }
void _M_swap_impl(_Head&) { /* no-op */ }
};
template<std::size_t _Idx, typename _Head>
......@@ -97,7 +97,7 @@ namespace std
const _Head& _M_head() const { return _M_head_impl; }
void
_M_swap_impl(_Head&& __h)
_M_swap_impl(_Head& __h)
{
using std::swap;
swap(__h, _M_head_impl);
......@@ -125,7 +125,7 @@ namespace std
struct _Tuple_impl<_Idx>
{
protected:
void _M_swap_impl(_Tuple_impl&&) { /* no-op */ }
void _M_swap_impl(_Tuple_impl&) { /* no-op */ }
};
/**
......@@ -214,7 +214,7 @@ namespace std
protected:
void
_M_swap_impl(_Tuple_impl&& __in)
_M_swap_impl(_Tuple_impl& __in)
{
_Base::_M_swap_impl(__in._M_head());
_Inherited::_M_swap_impl(__in._M_tail());
......@@ -292,7 +292,7 @@ namespace std
}
void
swap(tuple&& __in)
swap(tuple& __in)
{ _Inherited::_M_swap_impl(__in); }
};
......@@ -301,7 +301,7 @@ namespace std
class tuple<>
{
public:
void swap(tuple&&) { /* no-op */ }
void swap(tuple&) { /* no-op */ }
};
/// tuple (2-element), with construction and assignment from a pair.
......@@ -394,7 +394,7 @@ namespace std
}
void
swap(tuple&& __in)
swap(tuple& __in)
{
using std::swap;
swap(this->_M_head(), __in._M_head());
......@@ -665,16 +665,6 @@ namespace std
swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
{ __x.swap(__y); }
template<typename... _Elements>
inline void
swap(tuple<_Elements...>&& __x, tuple<_Elements...>& __y)
{ __x.swap(__y); }
template<typename... _Elements>
inline void
swap(tuple<_Elements...>& __x, tuple<_Elements...>&& __y)
{ __x.swap(__y); }
// A class (and instance) which can be used in 'tie' when an element
// of a tuple is not required
struct _Swallow_assign
......
......@@ -225,11 +225,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
~_Hashtable();
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
void swap(_Hashtable&&);
#else
void swap(_Hashtable&);
#endif
// Basic container operations
iterator
......@@ -732,11 +728,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
swap(_Hashtable&& __x)
#else
swap(_Hashtable& __x)
#endif
{
// The only base class with member variables is hash_code_base. We
// define _Hash_code_base::_M_swap because different specializations
......
......@@ -340,31 +340,5 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
{ __x.swap(__y); }
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NAMESPACE_TR1
}
......@@ -330,31 +330,5 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
template<class _Value, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>&& __x,
unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<class _Value, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_set<_Value, _Hash, _Pred, _Alloc>&& __y)
{ __x.swap(__y); }
template<class _Value, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __x,
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<class _Value, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NAMESPACE_TR1
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2008, 2009 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 20.7.12.2 Template class shared_ptr [util.smartptr.shared]
#include <memory>
#include <testsuite_hooks.h>
struct A { };
// 20.7.12.2.4 shared_ptr modifiers [util.smartptr.shared.mod]
// swap
int
test01()
{
bool test __attribute__((unused)) = true;
std::shared_ptr<A> p(new A);
p.swap(std::shared_ptr<A>(new A));
return 0;
}
int
main()
{
test01();
return 0;
}
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1498 }
// { dg-error "no matching" "" { target *-*-* } 1494 }
// { dg-excess-errors "" }
#include <deque>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1437 }
// { dg-error "no matching" "" { target *-*-* } 1433 }
// { dg-excess-errors "" }
#include <deque>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1437 }
// { dg-error "no matching" "" { target *-*-* } 1433 }
// { dg-excess-errors "" }
#include <deque>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1582 }
// { dg-error "no matching" "" { target *-*-* } 1578 }
// { dg-excess-errors "" }
#include <deque>
......
......@@ -43,10 +43,4 @@ namespace std {
template <class T, class Allocator>
void swap(forward_list<T,Allocator>& x, forward_list<T,Allocator>& y);
template <class T, class Allocator>
void swap(forward_list<T,Allocator>&& x, forward_list<T,Allocator>& y);
template <class T, class Allocator>
void swap(forward_list<T,Allocator>& x, forward_list<T,Allocator>&& y);
}
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1383 }
// { dg-error "no matching" "" { target *-*-* } 1379 }
// { dg-excess-errors "" }
#include <list>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1352 }
// { dg-error "no matching" "" { target *-*-* } 1348 }
// { dg-excess-errors "" }
#include <list>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1352 }
// { dg-error "no matching" "" { target *-*-* } 1348 }
// { dg-excess-errors "" }
#include <list>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1352 }
// { dg-error "no matching" "" { target *-*-* } 1348 }
// { dg-excess-errors "" }
#include <list>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1051 }
// { dg-error "no matching" "" { target *-*-* } 1047 }
// { dg-excess-errors "" }
#include <vector>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 991 }
// { dg-error "no matching" "" { target *-*-* } 987 }
// { dg-excess-errors "" }
#include <vector>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 991 }
// { dg-error "no matching" "" { target *-*-* } 987 }
// { dg-excess-errors "" }
#include <vector>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1092 }
// { dg-error "no matching" "" { target *-*-* } 1088 }
// { dg-excess-errors "" }
#include <vector>
......
......@@ -30,7 +30,34 @@
void f() { }
int main()
void test01()
{
bool test __attribute__((unused)) = true;
try
{
std::thread t1(f);
std::thread::id t1_id = t1.get_id();
std::thread t2;
t2.swap(t1);
VERIFY( t1.get_id() == std::thread::id() );
VERIFY( t2.get_id() == t1_id );
t2.join();
}
catch (const std::system_error&)
{
VERIFY( false );
}
catch (...)
{
VERIFY( false );
}
}
void test02()
{
bool test __attribute__((unused)) = true;
......@@ -40,8 +67,8 @@ int main()
std::thread::id t1_id = t1.get_id();
std::thread t2;
t2.swap(std::move(t1));
std::swap(t1, t2);
VERIFY( t1.get_id() == std::thread::id() );
VERIFY( t2.get_id() == t1_id );
......@@ -55,6 +82,12 @@ int main()
{
VERIFY( false );
}
}
int main()
{
test01();
test02();
return 0;
}
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
// { dg-require-cstdint "" }
// { dg-require-gthreads "" }
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <thread>
#include <system_error>
#include <bits/move.h> // std::move
#include <testsuite_hooks.h>
void f() { }
void test01()
{
try
{
std::thread t1(f);
std::thread::id t1_id = t1.get_id();
std::thread t2;
std::swap(t1, t2);
VERIFY( t1.get_id() == std::thread::id() );
VERIFY( t2.get_id() == t1_id );
t2.join();
}
catch (const std::system_error&)
{
VERIFY( false );
}
catch (...)
{
VERIFY( false );
}
}
void test02()
{
try
{
std::thread t1(f);
std::thread::id t1_id = t1.get_id();
std::thread t2;
std::swap(std::move(t1), t2);
VERIFY( t2.get_id() == t1_id );
t2.join();
}
catch (const std::system_error&)
{
VERIFY( false );
}
catch (...)
{
VERIFY( false );
}
}
void test03()
{
try
{
std::thread t1(f);
std::thread::id t1_id = t1.get_id();
std::thread t2;
std::swap(t2, std::move(t1));
VERIFY( t2.get_id() == t1_id );
t2.join();
}
catch (const std::system_error&)
{
VERIFY( false );
}
catch (...)
{
VERIFY( false );
}
}
int main()
{
test01();
test02();
test03();
return 0;
}
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