* include/bits/forward_list.h (splice_after): Use forward.
(merge): Likewise.
* include/bits/stl_iterator.h (move_iterator::operator*): Use move.
(move_iterator::operator[]): Use move.
* include/bits/stl_list.h (insert): Use move.
* include/std/thread (_Callable constructor): Use forward.
* include/std/tuple: Don't specify explicit template args to move.
From-SVN: r150326
+2009-07-31 Jason Merrill <jason@redhat.com>
+
+ * include/bits/forward_list.h (splice_after): Use forward.
+ (merge): Likewise.
+ * include/bits/stl_iterator.h (move_iterator::operator*): Use move.
+ (move_iterator::operator[]): Use move.
+ * include/bits/stl_list.h (insert): Use move.
+ * include/std/thread (_Callable constructor): Use forward.
+ * include/std/tuple: Don't specify explicit template args to move.
+
+ * testsuite/20_util/forward/requirements/explicit_instantiation.cc:
+ Adjust signature.
+ * testsuite/20_util/tuple/swap.cc: Swap takes lvalue reference.
+ * testsuite/30_threads/shared_future/cons/copy.cc: Return rvalue
+ reference.
+ * testsuite/20_util/shared_ptr/assign/auto_ptr.cc,
+ testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc,
+ testsuite/20_util/shared_ptr/cons/auto_ptr.cc,
+ testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc,
+ testsuite/23_containers/forward_list/ext_pointer/operations/1.cc,
+ testsuite/23_containers/forward_list/ext_pointer/operations/5.cc,
+ testsuite/23_containers/forward_list/operations/1.cc,
+ testsuite/23_containers/forward_list/operations/5.cc: Use move.
+ * testsuite/23_containers/list/requirements/dr438/assign_neg.cc,
+ testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc,
+ testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc,
+ testsuite/23_containers/list/requirements/dr438/insert_neg.cc,
+ testsuite/30_threads/thread/cons/assign_neg.cc: Adjust line numbers.
+
2009-07-31 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/40912 (partial)
void
splice_after(const_iterator __pos, forward_list&& __list,
const_iterator __it)
- { this->splice_after(__pos, __list, __it, __it._M_next()); }
+ {
+ this->splice_after(__pos, std::forward<forward_list>(__list),
+ __it, __it._M_next());
+ }
/**
* @brief Insert range from another %forward_list.
*/
void
merge(forward_list&& __list)
- { this->merge(__list, std::less<_Tp>()); }
+ { this->merge(std::forward<forward_list>(__list), std::less<_Tp>()); }
/**
* @brief Merge sorted lists according to comparison function.
reference
operator*() const
- { return *_M_current; }
+ { return std::move(*_M_current); }
pointer
operator->() const
reference
operator[](difference_type __n) const
- { return _M_current[__n]; }
+ { return std::move(_M_current[__n]); }
};
template<typename _IteratorL, typename _IteratorR>
insert(iterator __position, size_type __n, const value_type& __x)
{
list __tmp(__n, __x, _M_get_Node_allocator());
- splice(__position, __tmp);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ splice(__position, std::move(__tmp));
+#else
+ splice(__position, __tmp);
+#endif
}
/**
_InputIterator __last)
{
list __tmp(__first, __last, _M_get_Node_allocator());
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ splice(__position, std::move(__tmp));
+#else
splice(__position, __tmp);
+#endif
}
/**
template<typename _Callable>
explicit thread(_Callable __f)
- { _M_start_thread(_M_make_routine<_Callable>(__f)); }
+ {
+ _M_start_thread(_M_make_routine<_Callable>
+ (std::forward<_Callable>(__f)));
+ }
template<typename _Callable, typename... _Args>
thread(_Callable&& __f, _Args&&... __args)
: _Inherited(__in._M_tail()), _Base(__in._M_head()) { }
_Tuple_impl(_Tuple_impl&& __in)
- : _Inherited(std::move<_Inherited&&>(__in._M_tail())),
+ : _Inherited(std::move(__in._M_tail())),
_Base(std::forward<_Head>(__in._M_head())) { }
template<typename... _UElements>
template<typename... _UElements>
_Tuple_impl(_Tuple_impl<_Idx, _UElements...>&& __in)
- : _Inherited(std::move<typename _Tuple_impl<_Idx, _UElements...>::
- _Inherited&&>(__in._M_tail())),
+ : _Inherited(std::move(__in._M_tail())),
_Base(std::forward<typename _Tuple_impl<_Idx, _UElements...>::
_Base>(__in._M_head())) { }
: _Inherited(static_cast<const _Inherited&>(__in)) { }
tuple(tuple&& __in)
- : _Inherited(std::move<_Inherited>(__in)) { }
+ : _Inherited(static_cast<_Inherited&&>(__in)) { }
template<typename... _UElements>
tuple(const tuple<_UElements...>& __in)
template<typename... _UElements>
tuple(tuple<_UElements...>&& __in)
- : _Inherited(std::move<_Tuple_impl<0, _UElements...> >(__in)) { }
+ : _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) { }
// XXX http://gcc.gnu.org/ml/libstdc++/2008-02/msg00047.html
template<typename... _UElements>
: _Inherited(static_cast<const _Inherited&>(__in)) { }
tuple(tuple&& __in)
- : _Inherited(std::move<_Inherited>(__in)) { }
+ : _Inherited(static_cast<_Inherited&&>(__in)) { }
template<typename _U1, typename _U2>
tuple(const tuple<_U1, _U2>& __in)
template<typename _U1, typename _U2>
tuple(tuple<_U1, _U2>&& __in)
- : _Inherited(std::move<_Tuple_impl<0, _U1, _U2> >(__in)) { }
+ : _Inherited(static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in)) { }
template<typename _U1, typename _U2>
tuple(const pair<_U1, _U2>& __in)
namespace std
{
typedef short test_type;
- template test_type&& forward(std::identity<test_type>::type&&);
+ template test_type&& forward<test_type>(test_type&&);
}
std::shared_ptr<A> a(new A);
std::auto_ptr<B> b(new B);
- a = b;
+ a = std::move(b);
VERIFY( a.get() != 0 );
VERIFY( b.get() == 0 );
VERIFY( A::ctor_count == 2 );
std::shared_ptr<A> a;
std::auto_ptr<B> b;
- a = b; // { dg-error "here" }
+ a = std::move(b); // { dg-error "here" }
return 0;
}
bool test __attribute__((unused)) = true;
std::auto_ptr<A> a(new A);
- std::shared_ptr<A> a2(a);
+ std::shared_ptr<A> a2(std::move(a));
VERIFY( a.get() == 0 );
VERIFY( a2.get() != 0 );
VERIFY( a2.use_count() == 1 );
bool test __attribute__((unused)) = true;
const std::auto_ptr<A> a;
- std::shared_ptr<A> p(a); // { dg-error "no match" }
+ std::shared_ptr<A> p(std::move(a)); // { dg-error "no match" }
return 0;
}
bool operator==(MoveOnly const& m)
{ return i == m.i; }
- void swap(MoveOnly&& m)
+ void swap(MoveOnly& m)
{ std::swap(m.i, i); }
int i;
fwd_list_type x = {666.0, 777.0, 888.0};
- a.splice_after(posa, x);
+ a.splice_after(posa, std::move(x));
++posa;
VERIFY(*posa == 666.0);
++endy;
VERIFY(*endy == 14.0);
- a.splice_after(posa, y, befy, endy);
+ a.splice_after(posa, std::move(y), befy, endy);
VERIFY(*posa == 0.0);
VERIFY(*befy == 10.0);
fwd_list_type::const_iterator posz = z.begin();
VERIFY(*posz == 42.0);
- a.splice_after(posa, z, posz);
+ a.splice_after(posa, std::move(z), posz);
VERIFY(*posa == 1.0);
++posa;
VERIFY(*posa == 43.0);
fwd_list_type a = {0.0, 1.0, 2.0, 3.0, 4.0};
fwd_list_type b = {1.0, 2.0, 3.0, 4.0, 4.0, 5.0};
- a.merge(b);
+ a.merge(std::move(b));
fwd_list_type r = {0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 4.0, 5.0};
std::forward_list<double> x = {666.0, 777.0, 888.0};
- a.splice_after(posa, x);
+ a.splice_after(posa, std::move(x));
++posa;
VERIFY(*posa == 666.0);
++endy;
VERIFY(*endy == 14.0);
- a.splice_after(posa, y, befy, endy);
+ a.splice_after(posa, std::move(y), befy, endy);
VERIFY(*posa == 0.0);
VERIFY(*befy == 10.0);
std::forward_list<double>::const_iterator posz = z.begin();
VERIFY(*posz == 42.0);
- a.splice_after(posa, z, posz);
+ a.splice_after(posa, std::move(z), posz);
VERIFY(*posa == 1.0);
++posa;
VERIFY(*posa == 43.0);
std::forward_list<double> a = {0.0, 1.0, 2.0, 3.0, 4.0};
std::forward_list<double> b = {1.0, 2.0, 3.0, 4.0, 4.0, 5.0};
- a.merge(b);
+ a.merge(std::move(b));
std::forward_list<double> r = {0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0,
4.0, 4.0, 4.0, 5.0};
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1379 }
+// { dg-error "no matching" "" { target *-*-* } 1387 }
// { dg-excess-errors "" }
#include <list>
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1348 }
+// { dg-error "no matching" "" { target *-*-* } 1356 }
// { dg-excess-errors "" }
#include <list>
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1348 }
+// { dg-error "no matching" "" { target *-*-* } 1356 }
// { dg-excess-errors "" }
#include <list>
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1348 }
+// { dg-error "no matching" "" { target *-*-* } 1356 }
// { dg-excess-errors "" }
#include <list>
#include <future>
#include <testsuite_hooks.h>
-extern std::unique_future<int>& get();
+extern std::unique_future<int>&& get();
void test01()
{
}
// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 141 }
+// { dg-error "deleted function" "" { target *-*-* } 144 }