]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2010-06-10 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Jun 2010 10:24:46 +0000 (10:24 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Jun 2010 10:24:46 +0000 (10:24 +0000)
PR libstdc++/44487
* include/bits/stl_pair.h (pair(pair&&)): Remove.
(pair(pair<_U1, _U2>&&): Use forward, consistently with Bullet 5
of LWG 1326.
* include/std/tuple (tuple(pair<_U1, _U2>&&)): Likewise.
* testsuite/20_util/pair/44487.cc: Add.
* testsuite/20_util/tuple/cons/44487.cc: Likewise.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-warning
line numbers.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160528 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_pair.h
libstdc++-v3/include/std/tuple
libstdc++-v3/testsuite/20_util/pair/44487.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/tuple/cons/44487.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc

index 82fc51d3ace2142c87d0353e2bc888dabf14deb3..f280f119d220c880b231fdbdabed0f4851507cd0 100644 (file)
@@ -1,3 +1,15 @@
+2010-06-10  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR libstdc++/44487
+       * include/bits/stl_pair.h (pair(pair&&)): Remove.
+       (pair(pair<_U1, _U2>&&): Use forward, consistently with Bullet 5
+       of LWG 1326.
+       * include/std/tuple (tuple(pair<_U1, _U2>&&)): Likewise.
+       * testsuite/20_util/pair/44487.cc: Add.
+       * testsuite/20_util/tuple/cons/44487.cc: Likewise.
+       * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-warning
+       line numbers.
+
 2010-06-09  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * include/std/type_traits (is_nothrow_constructible): Add.
index 6c2b51e4c6b201a9ee94247778a7f147ad7525e2..c5f2986fb77c102ae8214b705b4b6b1c5207b461 100644 (file)
@@ -120,10 +120,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        : first(std::forward<_U1>(__x)),
          second(std::forward<_U2>(__y)) { }
 
-      pair(pair&& __p)
-      : first(std::move(__p.first)),
-       second(std::move(__p.second)) { }
-
       template<class... _Args1, class... _Args2>
         pair(piecewise_construct_t,
             tuple<_Args1...> __first_args,
@@ -141,8 +137,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<class _U1, class _U2>
         pair(pair<_U1, _U2>&& __p)
-       : first(std::move(__p.first)),
-         second(std::move(__p.second)) { }
+       : first(std::forward<_U1>(__p.first)),
+         second(std::forward<_U2>(__p.second)) { }
 
       pair&
       operator=(pair&& __p)
index f9aa14f205788bbea0043f50b5a325611975ebfe..027442ddd7169cb232f2d5ac1ce5079998a3410d 100644 (file)
@@ -341,7 +341,8 @@ namespace std
 
       template<typename _U1, typename _U2>
         tuple(pair<_U1, _U2>&& __in)
-       : _Inherited(std::move(__in.first), std::move(__in.second)) { }
+       : _Inherited(std::forward<_U1>(__in.first),
+                    std::forward<_U2>(__in.second)) { }
 
       tuple&
       operator=(const tuple& __in)
diff --git a/libstdc++-v3/testsuite/20_util/pair/44487.cc b/libstdc++-v3/testsuite/20_util/pair/44487.cc
new file mode 100644 (file)
index 0000000..833d986
--- /dev/null
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2010 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 <utility>
+
+int x, y;
+
+std::pair<int&, int&>
+foo1()
+{
+  std::pair<int&, int&> blah(x, y);
+  return blah;
+}
+
+std::pair<int&, int&>
+foo2()
+{
+  const std::pair<int&, int&> blah(x, y);
+  return blah;
+}
+
+std::pair<int&, int&>
+foo3()
+{
+  std::pair<int&, int&> blah(x, y);
+  return std::pair<int&, int&>(std::move(blah));
+}
+
+std::pair<int&, int&>
+foo4()
+{
+  const std::pair<int&, int&> blah(x, y);
+  return std::pair<int&, int&>(std::move(blah));
+}
diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/44487.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/44487.cc
new file mode 100644 (file)
index 0000000..dade58d
--- /dev/null
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2010 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 <tuple>
+
+int x, y;
+
+std::tuple<int&, int&>
+foo1()
+{
+  std::pair<int&, int&> blah(x, y);
+  return blah;
+}
+
+std::tuple<int&, int&>
+foo2()
+{
+  const std::pair<int&, int&> blah(x, y);
+  return blah;
+}
+
+std::tuple<int&, int&>
+foo3()
+{
+  std::pair<int&, int&> blah(x, y);
+  return std::tuple<int&, int&>(std::move(blah));
+}
+
+std::tuple<int&, int&>
+foo4()
+{
+  const std::pair<int&, int&> blah(x, y);
+  return std::tuple<int&, int&>(std::move(blah));
+}
index b3a45b11018ef8e96cb9d07c3265967d8d2de81e..17d662accae3d0637a379c1726dac39486793d4b 100644 (file)
@@ -44,8 +44,8 @@ main()
 // { dg-warning "note" "" { target *-*-* } 324 }
 // { dg-warning "note" "" { target *-*-* } 423 }
 // { dg-warning "note" "" { target *-*-* } 862 }
-// { dg-warning "note" "" { target *-*-* } 511 }
+// { dg-warning "note" "" { target *-*-* } 512 }
 // { dg-warning "note" "" { target *-*-* } 1005 }
 // { dg-warning "note" "" { target *-*-* } 340 }
 // { dg-warning "note" "" { target *-*-* } 290 }
-// { dg-warning "note" "" { target *-*-* } 201 }
+// { dg-warning "note" "" { target *-*-* } 197 }