@@ -1336,8 +1336,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
else
// The rvalue's allocator cannot be moved, or is not equal,
// so we need to individually move each element.
- this->assign(std::__make_move_if_noexcept_iterator(__list.begin()),
- std::__make_move_if_noexcept_iterator(__list.end()));
+ this->assign(std::make_move_iterator(__list.begin()),
+ std::make_move_iterator(__list.end()));
}
// Called by assign(_InputIterator, _InputIterator) if _Tp is
@@ -2256,8 +2256,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{
// The rvalue's allocator cannot be moved and is not equal,
// so we need to individually move each element.
- _M_assign_aux(std::__make_move_if_noexcept_iterator(__x.begin()),
- std::__make_move_if_noexcept_iterator(__x.end()),
+ _M_assign_aux(std::make_move_iterator(__x.begin()),
+ std::make_move_iterator(__x.end()),
std::random_access_iterator_tag());
__x.clear();
}
@@ -1957,8 +1957,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
else
// The rvalue's allocator cannot be moved, or is not equal,
// so we need to individually move each element.
- _M_assign_dispatch(std::__make_move_if_noexcept_iterator(__x.begin()),
- std::__make_move_if_noexcept_iterator(__x.end()),
+ _M_assign_dispatch(std::make_move_iterator(__x.begin()),
+ std::make_move_iterator(__x.end()),
__false_type{});
}
#endif
@@ -1828,8 +1828,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{
// The rvalue's allocator cannot be moved and is not equal,
// so we need to individually move each element.
- this->assign(std::__make_move_if_noexcept_iterator(__x.begin()),
- std::__make_move_if_noexcept_iterator(__x.end()));
+ this->_M_assign_aux(std::make_move_iterator(__x.begin()),
+ std::make_move_iterator(__x.end()),
+ std::random_access_iterator_tag());
__x.clear();
}
}
new file mode 100644
@@ -0,0 +1,49 @@
+// Copyright (C) 2019 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/>.
+
+// { dg-do run { target c++11 } }
+
+#include <deque>
+#include <testsuite_allocator.h>
+
+struct X {
+ X() = default;
+ X(const X&) = default;
+
+ // Move constructor might throw
+ X(X&&) noexcept(false) {}
+
+ // Tracking calls to assignment functions
+ X& operator=(const X&) { throw 1; }
+
+ X& operator=(X&&) noexcept(true) { return *this; }
+};
+
+void
+test01()
+{
+ using A = __gnu_test::propagating_allocator<X, false>;
+ A a1(1), a2(2);
+ std::deque<X, A> v1(1, a1), v2(1, a2);
+ v1 = std::move(v2);
+}
+
+int
+main()
+{
+ test01();
+}
new file mode 100644
@@ -0,0 +1,49 @@
+// Copyright (C) 2019 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/>.
+
+// { dg-do run { target c++11 } }
+
+#include <forward_list>
+#include <testsuite_allocator.h>
+
+struct X {
+ X() = default;
+ X(const X&) = default;
+
+ // Move constructor might throw
+ X(X&&) noexcept(false) {}
+
+ // Tracking calls to assignment functions
+ X& operator=(const X&) { throw 1; }
+
+ X& operator=(X&&) noexcept(true) { return *this; }
+};
+
+void
+test01()
+{
+ using A = __gnu_test::propagating_allocator<X, false>;
+ A a1(1), a2(2);
+ std::forward_list<X, A> v1(1, a1), v2(1, a2);
+ v1 = std::move(v2);
+}
+
+int
+main()
+{
+ test01();
+}
new file mode 100644
@@ -0,0 +1,49 @@
+// Copyright (C) 2019 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/>.
+
+// { dg-do run { target c++11 } }
+
+#include <list>
+#include <testsuite_allocator.h>
+
+struct X {
+ X() = default;
+ X(const X&) = default;
+
+ // Move constructor might throw
+ X(X&&) noexcept(false) {}
+
+ // Tracking calls to assignment functions
+ X& operator=(const X&) { throw 1; }
+
+ X& operator=(X&&) noexcept(true) { return *this; }
+};
+
+void
+test01()
+{
+ using A = __gnu_test::propagating_allocator<X, false>;
+ A a1(1), a2(2);
+ std::list<X, A> v1(1, a1), v2(1, a2);
+ v1 = std::move(v2);
+}
+
+int
+main()
+{
+ test01();
+}
new file mode 100644
@@ -0,0 +1,49 @@
+// Copyright (C) 2019 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/>.
+
+// { dg-do run { target c++11 } }
+
+#include <vector>
+#include <testsuite_allocator.h>
+
+struct X {
+ X() = default;
+ X(const X&) = default;
+
+ // Move constructor might throw
+ X(X&&) noexcept(false) {}
+
+ // Tracking calls to assignment functions
+ X& operator=(const X&) { throw 1; }
+
+ X& operator=(X&&) noexcept(true) { return *this; }
+};
+
+void
+test01()
+{
+ using A = __gnu_test::propagating_allocator<X, false>;
+ A a1(1), a2(2);
+ std::vector<X, A> v1(1, a1), v2(1, a2);
+ v1 = std::move(v2);
+}
+
+int
+main()
+{
+ test01();
+}