]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
forward_list.h (splice_after): Use forward.
authorJason Merrill <jason@redhat.com>
Sat, 1 Aug 2009 02:26:32 +0000 (22:26 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 1 Aug 2009 02:26:32 +0000 (22:26 -0400)
* 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

22 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/forward_list.h
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/include/bits/stl_list.h
libstdc++-v3/include/std/thread
libstdc++-v3/include/std/tuple
libstdc++-v3/testsuite/20_util/forward/requirements/explicit_instantiation.cc
libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc
libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc
libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc
libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc
libstdc++-v3/testsuite/20_util/tuple/swap.cc
libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/1.cc
libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/5.cc
libstdc++-v3/testsuite/23_containers/forward_list/operations/1.cc
libstdc++-v3/testsuite/23_containers/forward_list/operations/5.cc
libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
libstdc++-v3/testsuite/30_threads/shared_future/cons/copy.cc
libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc

index 9707f48627c6f9b7b7352f2c574bde0693634416..eb8b0e727fee64fc1147ca6607b22ae615f70b2a 100644 (file)
@@ -1,3 +1,32 @@
+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)
index 724d87b01b1a30729d9c62a21092008341e9d276..5158f2dac64e3c54ffd7008752f233eb4af64ff3 100644 (file)
@@ -1057,7 +1057,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       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.
@@ -1146,7 +1149,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        */
       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.
index 129552f3705620225155f08ec33dd94aac6f4334..eb7290053ed30d267c2ba532596f49bd5967b0e9 100644 (file)
@@ -913,7 +913,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
       reference
       operator*() const
-      { return *_M_current; }
+      { return std::move(*_M_current); }
 
       pointer
       operator->() const
@@ -973,7 +973,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
       reference
       operator[](difference_type __n) const
-      { return _M_current[__n]; }
+      { return std::move(_M_current[__n]); }
     };
 
   template<typename _IteratorL, typename _IteratorR>
index f758baed5c9a50fb2ce22b1660fbd97a6c856f78..2a6e58f798f7d221ad51cc1692c54d66a2197ddc 100644 (file)
@@ -1027,7 +1027,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
       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
       }
 
       /**
@@ -1049,7 +1053,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
               _InputIterator __last)
         {
          list __tmp(__first, __last, _M_get_Node_allocator());
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+         splice(__position, std::move(__tmp));
+#else
          splice(__position, __tmp);
+#endif
        }
 
       /**
index bf282cc03658d48e2d8157fb645163895141bf91..83b259d7949dfe50c9eab6d5fc2f7ec194a3468f 100644 (file)
@@ -126,7 +126,10 @@ namespace std
 
     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)
index 8dc8dcfc064acca04cffe9d6e9f15d208f9f9191..18cd89bca3b3a9684ba3d8ebbacf5554baac434a 100644 (file)
@@ -164,7 +164,7 @@ namespace std
       : _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>
@@ -173,8 +173,7 @@ namespace std
 
       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())) { }
 
@@ -244,7 +243,7 @@ namespace std
       : _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)
@@ -253,7 +252,7 @@ namespace std
 
       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>
@@ -327,7 +326,7 @@ namespace std
       : _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)
@@ -335,7 +334,7 @@ namespace std
 
       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)
index 8b14da23a95f3606b96d00057a3c93f481da3dbe..88ba9e548af13acb087f081c78711075b12b00d6 100644 (file)
@@ -28,5 +28,5 @@
 namespace std
 {
   typedef short test_type;
-  template test_type&& forward(std::identity<test_type>::type&&);
+  template test_type&& forward<test_type>(test_type&&);
 }
index e8c751bba5cee31523c420e8310ae032156b0688..e2ec0786055d56bb001f4897559ff7c10dc4c5c1 100644 (file)
@@ -66,7 +66,7 @@ test01()
 
   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 );
index 155449438cf2002c38dc66c97645054c61f69a74..b79a25b131c4b8ea64d25cb35d40d2a72a11d0e7 100644 (file)
@@ -36,7 +36,7 @@ test01()
 
   std::shared_ptr<A> a;
   std::auto_ptr<B> b;
-  a = b;                      // { dg-error "here" }
+  a = std::move(b);                      // { dg-error "here" }
 
   return 0;
 }
index 9087e518ad9e69812205b22e8709e3d029a8ae30..eb5bb9590df0f2355dce546f15c171bea6388616 100644 (file)
@@ -33,7 +33,7 @@ test01()
   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 );
index 3a946b5872bd4da9c9884e5abdc1645661c1f6fa..e2ef60e3fbb21e03b5cbd77014956b75df45cef8 100644 (file)
@@ -34,7 +34,7 @@ test01()
   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;
 }
index 6dab446bfe98c4e6af301b52fd1610cd2a888c38..613e9c2ff1c4e15cfdd0af201e09a78b6c1aa212 100644 (file)
@@ -41,7 +41,7 @@ struct MoveOnly
   bool operator==(MoveOnly const& m)
   { return i == m.i; }
 
-  void swap(MoveOnly&& m)
+  void swap(MoveOnly& m)
   { std::swap(m.i, i); }
 
   int i;
index 0d9361a37d06ce2d3e76c1e46779921a740bf7aa..8b5afdd980b8da0207f0c6baa5a550b74bef1e02 100644 (file)
@@ -39,7 +39,7 @@ test01()
 
   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);
@@ -70,7 +70,7 @@ test02()
   ++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);
@@ -95,7 +95,7 @@ test03()
   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);
index 434a9aaac959f563abad79154b121285d73b5558..13d15b39d122941328810a21efab2ab32fcd3839 100644 (file)
@@ -37,7 +37,7 @@ test01()
   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};
 
index 1f86db9743f2725b058cf0b289843c0cd57a1dd1..5a996f3411e045ea997eb6a0950ce31242b526c9 100644 (file)
@@ -34,7 +34,7 @@ test01()
 
   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);
@@ -63,7 +63,7 @@ test02()
   ++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);
@@ -86,7 +86,7 @@ test03()
   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);
index 05e3f844410212656010788d5f3ade10f456dd38..1291a269044acd19e63d72c4dfc9a3d513f7ebc0 100644 (file)
@@ -32,7 +32,7 @@ test01()
   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};
index cd2b29948072c9e4e0e5857c5d29190b5059bd80..c0b6ea46be9adec0b34f5c7d1c32ce52490c7bd1 100644 (file)
@@ -18,7 +18,7 @@
 // <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>
index cc2b419bd4e190a38e83c8ed6ec705a2b1c442e7..0d27211a5f7c72c25329981e28de86e50405302e 100644 (file)
@@ -18,7 +18,7 @@
 // <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>
index d650a9ec10280dfb3d0040c876e21dd6bf44d55f..bbf780803657b7aeac6ff725836f095556919651 100644 (file)
@@ -18,7 +18,7 @@
 // <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>
index ae9e63f704ed39211e493c5566ef4341014d94bf..1e84b97d3017b36eb330295883b2cd9084466b7d 100644 (file)
@@ -18,7 +18,7 @@
 // <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>
index 16954a1d4c195032d889bc0a7ce3389dd86773aa..b1940fae3c75c3b6cfefad548065fa94b2704ead 100644 (file)
@@ -25,7 +25,7 @@
 #include <future>
 #include <testsuite_hooks.h>
 
-extern std::unique_future<int>& get();
+extern std::unique_future<int>&& get();
 
 void test01()
 {
index 7857e53bac7ae8f92679efdb2e50f9d585d68379..1ea66ec9c81271bf778837ccd82d0aace0d49f44 100644 (file)
@@ -32,4 +32,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 141 }
+// { dg-error "deleted function" "" { target *-*-* } 144 }