+2018-05-02 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/bits/deque.tcc (deque<>::_M_assign_aux): Cast to void to
+ ensure overloaded comma not used.
+ * include/bits/list.tcc (list<>::_M_assign_dispatch): Likewise.
+ * include/bits/vector.tcc (vector<>::_M_assign_aux): Likewise.
+ * include/bits/stl_bvector.h (vector<bool>::_M_assign_aux): Likewise.
+ * testsuite/23_containers/deque/modifiers/assign/1.cc: New.
+ * testsuite/23_containers/list/modifiers/assign/1.cc: New.
+ * testsuite/23_containers/vector/bool/modifiers/assign/1.cc: New.
+ * testsuite/23_containers/vector/modifiers/assign/1.cc: New.
+
2018-05-02 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/68197
std::input_iterator_tag)
{
iterator __cur = begin();
- for (; __first != __last && __cur != end(); ++__cur, ++__first)
+ for (; __first != __last && __cur != end(); ++__cur, (void)++__first)
*__cur = *__first;
if (__first == __last)
_M_erase_at_end(__cur);
iterator __first1 = begin();
iterator __last1 = end();
for (; __first1 != __last1 && __first2 != __last2;
- ++__first1, ++__first2)
+ ++__first1, (void)++__first2)
*__first1 = *__first2;
if (__first2 == __last2)
erase(__first1, __last1);
std::input_iterator_tag)
{
iterator __cur = begin();
- for (; __first != __last && __cur != end(); ++__cur, ++__first)
+ for (; __first != __last && __cur != end(); ++__cur, (void)++__first)
*__cur = *__first;
if (__first == __last)
_M_erase_at_end(__cur);
{
pointer __cur(this->_M_impl._M_start);
for (; __first != __last && __cur != this->_M_impl._M_finish;
- ++__cur, ++__first)
+ ++__cur, (void)++__first)
*__cur = *__first;
if (__first == __last)
_M_erase_at_end(__cur);
--- /dev/null
+// Copyright (C) 2018 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 <deque>
+
+#include <testsuite_iterators.h>
+#include <testsuite_hooks.h>
+
+typedef __gnu_test::test_container<int, __gnu_test::input_iterator_wrapper>
+ input_iterator_seq;
+
+int main()
+{
+ std::deque<int> d;
+
+ int array[] { 0, 1, 2 };
+ input_iterator_seq seq(array, array + 3);
+
+ d.assign(seq.begin(), seq.end());
+ VERIFY( d.size() == 3 );
+ return 0;
+}
--- /dev/null
+// Copyright (C) 2018 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 <list>
+
+#include <testsuite_iterators.h>
+#include <testsuite_hooks.h>
+
+typedef __gnu_test::test_container<int, __gnu_test::input_iterator_wrapper>
+ input_iterator_seq;
+
+int main()
+{
+ std::list<int> l;
+
+ int array[] { 0, 1, 2 };
+ input_iterator_seq seq(array, array + 3);
+
+ l.assign(seq.begin(), seq.end());
+ VERIFY( !l.empty() );
+ return 0;
+}
--- /dev/null
+// Copyright (C) 2018 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 <vector>
+
+#include <testsuite_iterators.h>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ typedef __gnu_test::test_container<bool, __gnu_test::input_iterator_wrapper>
+ input_iterator_seq;
+
+ std::vector<bool> bv;
+
+ bool array[] { false, true, true };
+ input_iterator_seq seq(array, array + 3);
+
+ bv.assign(seq.begin(), seq.end());
+ VERIFY( bv.size() == 3 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// Copyright (C) 2018 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 <vector>
+
+#include <testsuite_iterators.h>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ typedef __gnu_test::test_container<int, __gnu_test::input_iterator_wrapper>
+ input_iterator_seq;
+
+ std::vector<int> v;
+
+ int array[] { 0, 1, 2 };
+ input_iterator_seq seq(array, array + 3);
+
+ v.assign(seq.begin(), seq.end());
+ VERIFY( v.size() == 3 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}