From 874e360b8c06066cda9febb91430bc630eb0de1b Mon Sep 17 00:00:00 2001
From: Paolo Carlini <paolo.carlini@oracle.com>
Date: Mon, 14 Dec 2009 10:26:09 +0000
Subject: [PATCH] stl_list.h (splice(iterator, list&), [...]): Re-add in C++0x
 mode for backward compatibility (see DR 1133).

2009-12-14  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/stl_list.h (splice(iterator, list&), splice(iterator,
	list&, iterator), splice(iterator, list&, iterator, iterator),
	merge(list&), merge(list&, _StrictWeakOrdering)): Re-add in C++0x
	mode for backward compatibility (see DR 1133).
	(insert(iterator, size_type, const value_type&), insert(iterator,
	_InputIterator, _InputIterator)): Adjust.
	* include/bits/list.tcc (sort): Likewise.
	* testsuite/23_containers/list/modifiers/1_c++0x.cc: Add.
	* testsuite/23_containers/list/operations/2_c++0x.cc: Likewise.
	* testsuite/23_containers/list/operations/3_c++0x.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	assign_neg.cc: Adjust dg-error line numbers.
	* testsuite/23_containers/list/requirements/dr438/
	insert_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.

From-SVN: r155210
---
 libstdc++-v3/ChangeLog                        | 21 +++++++++
 libstdc++-v3/include/bits/list.tcc            | 12 ++---
 libstdc++-v3/include/bits/stl_list.h          | 44 ++++++++++++++-----
 .../23_containers/list/modifiers/1_c++0x.cc   | 27 ++++++++++++
 .../23_containers/list/operations/2_c++0x.cc  | 27 ++++++++++++
 .../23_containers/list/operations/3_c++0x.cc  | 27 ++++++++++++
 .../list/requirements/dr438/assign_neg.cc     |  2 +-
 .../requirements/dr438/constructor_1_neg.cc   |  2 +-
 .../requirements/dr438/constructor_2_neg.cc   |  2 +-
 .../list/requirements/dr438/insert_neg.cc     |  2 +-
 10 files changed, 145 insertions(+), 21 deletions(-)
 create mode 100644 libstdc++-v3/testsuite/23_containers/list/modifiers/1_c++0x.cc
 create mode 100644 libstdc++-v3/testsuite/23_containers/list/operations/2_c++0x.cc
 create mode 100644 libstdc++-v3/testsuite/23_containers/list/operations/3_c++0x.cc

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 39d1d7077400..7c20083923a5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,24 @@
+2009-12-14  Paolo Carlini  <paolo.carlini@oracle.com>
+
+	* include/bits/stl_list.h (splice(iterator, list&), splice(iterator,
+	list&, iterator), splice(iterator, list&, iterator, iterator),
+	merge(list&), merge(list&, _StrictWeakOrdering)): Re-add in C++0x
+	mode for backward compatibility (see DR 1133).
+	(insert(iterator, size_type, const value_type&), insert(iterator,
+	_InputIterator, _InputIterator)): Adjust.
+	* include/bits/list.tcc (sort): Likewise.
+	* testsuite/23_containers/list/modifiers/1_c++0x.cc: Add.
+	* testsuite/23_containers/list/operations/2_c++0x.cc: Likewise.
+	* testsuite/23_containers/list/operations/3_c++0x.cc: Likewise.
+	* testsuite/23_containers/list/requirements/dr438/
+	assign_neg.cc: Adjust dg-error line numbers.
+	* testsuite/23_containers/list/requirements/dr438/
+	insert_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.
+
 2009-12-11  Paolo Carlini  <paolo.carlini@oracle.com>
 	    Matthias Klose  <doko@ubuntu.com>
 
diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index c461a41c80dd..899b41815094 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -312,13 +312,13 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
 
         do
 	  {
-	    __carry.splice(__carry.begin(), _GLIBCXX_MOVE(*this), begin());
+	    __carry.splice(__carry.begin(), *this, begin());
 
 	    for(__counter = &__tmp[0];
 		__counter != __fill && !__counter->empty();
 		++__counter)
 	      {
-		__counter->merge(_GLIBCXX_MOVE(__carry));
+		__counter->merge(__carry);
 		__carry.swap(*__counter);
 	      }
 	    __carry.swap(*__counter);
@@ -328,7 +328,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
 	while ( !empty() );
 
         for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
-          __counter->merge(_GLIBCXX_MOVE(*(__counter - 1)));
+          __counter->merge(*(__counter - 1));
         swap( *(__fill - 1) );
       }
     }
@@ -389,13 +389,13 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
 
 	    do
 	      {
-		__carry.splice(__carry.begin(), _GLIBCXX_MOVE(*this), begin());
+		__carry.splice(__carry.begin(), *this, begin());
 
 		for(__counter = &__tmp[0];
 		    __counter != __fill && !__counter->empty();
 		    ++__counter)
 		  {
-		    __counter->merge(_GLIBCXX_MOVE(__carry), __comp);
+		    __counter->merge(__carry, __comp);
 		    __carry.swap(*__counter);
 		  }
 		__carry.swap(*__counter);
@@ -405,7 +405,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
 	    while ( !empty() );
 
 	    for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
-	      __counter->merge(_GLIBCXX_MOVE(*(__counter - 1)), __comp);
+	      __counter->merge(*(__counter - 1), __comp);
 	    swap(*(__fill - 1));
 	  }
       }
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index 2a6e58f798f7..51f8a8f931df 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -1027,11 +1027,7 @@ _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());
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-	  splice(__position, std::move(__tmp));
-#else
-	  splice(__position, __tmp);
-#endif
+	splice(__position, __tmp);
       }
 
       /**
@@ -1053,11 +1049,7 @@ _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
 	}
 
       /**
@@ -1164,6 +1156,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
 	  }
       }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x)
+      { splice(__position, std::move(__x)); }
+#endif
+
       /**
        *  @brief  Insert element from another %list.
        *  @param  position  Iterator referencing the element to insert before.
@@ -1191,6 +1189,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
 	this->_M_transfer(__position, __i, __j);
       }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x, iterator __i)
+      { splice(__position, std::move(__x), __i); }
+#endif
+
       /**
        *  @brief  Insert range from another %list.
        *  @param  position  Iterator referencing the element to insert before.
@@ -1221,6 +1225,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
 	  }
       }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x, iterator __first, iterator __last)
+      { splice(__position, std::move(__x), __first, __last); }
+#endif
+
       /**
        *  @brief  Remove all elements equal to value.
        *  @param  value  The value to remove.
@@ -1288,10 +1298,15 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
        *  sorted order, leaving @a x empty when complete.  Elements in
        *  this list precede elements in @a x that are equal.
        */
-      void
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
       merge(list&& __x);
+
+      void
+      merge(list& __x)
+      { merge(std::move(__x)); }
 #else
+      void
       merge(list& __x);
 #endif
 
@@ -1307,11 +1322,18 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
        *  in this list precede elements in @a x that are equivalent
        *  according to StrictWeakOrdering().
        */
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _StrictWeakOrdering>
         void
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
         merge(list&&, _StrictWeakOrdering);
+
+      template<typename _StrictWeakOrdering>
+        void
+        merge(list& __x, _StrictWeakOrdering __comp)
+        { merge(std::move(__x), __comp); }
 #else
+      template<typename _StrictWeakOrdering>
+        void
         merge(list&, _StrictWeakOrdering);
 #endif
 
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/1_c++0x.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/1_c++0x.cc
new file mode 100644
index 000000000000..c055f70bc741
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/1_c++0x.cc
@@ -0,0 +1,27 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 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 Pred 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 "1.h"
+#include <list>
+
+int main()
+{
+  modifiers1<std::list<__gnu_test::copy_tracker> >();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/2_c++0x.cc b/libstdc++-v3/testsuite/23_containers/list/operations/2_c++0x.cc
new file mode 100644
index 000000000000..faaf2f765b1e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/2_c++0x.cc
@@ -0,0 +1,27 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 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 Pred 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 "2.h"
+#include <list>
+
+int main()
+{
+  operations02<std::list<int> >();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/3_c++0x.cc b/libstdc++-v3/testsuite/23_containers/list/operations/3_c++0x.cc
new file mode 100644
index 000000000000..0598cfb225bd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/3_c++0x.cc
@@ -0,0 +1,27 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 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 Pred 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 "3.h"
+#include <list>
+
+int main()
+{
+  operations03<std::list<int> >();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
index c0b6ea46be9a..a9ef74472bf2 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1387 }
+// { dg-error "no matching" "" { target *-*-* } 1409 }
 // { dg-excess-errors "" }
 
 #include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
index 0d27211a5f7c..a3e29627f8dc 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1356 }
+// { dg-error "no matching" "" { target *-*-* } 1378 }
 // { dg-excess-errors "" }
 
 #include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
index bbf780803657..f90ed940727d 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1356 }
+// { dg-error "no matching" "" { target *-*-* } 1378 }
 // { dg-excess-errors "" }
 
 #include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
index 1e84b97d3017..24bcee0c7fd3 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1356 }
+// { dg-error "no matching" "" { target *-*-* } 1378 }
 // { dg-excess-errors "" }
 
 #include <list>
-- 
GitLab