deque.tcc (deque<>::_M_assign_aux): Cast to void to ensure overloaded comma not used.
authorFrançois Dumont <fdumont@gcc.gnu.org>
Wed, 2 May 2018 19:51:33 +0000 (19:51 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Wed, 2 May 2018 19:51:33 +0000 (19:51 +0000)
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.

From-SVN: r259856

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/deque.tcc
libstdc++-v3/include/bits/list.tcc
libstdc++-v3/include/bits/stl_bvector.h
libstdc++-v3/include/bits/vector.tcc
libstdc++-v3/testsuite/23_containers/deque/modifiers/assign/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/list/modifiers/assign/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/assign/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/vector/modifiers/assign/1.cc [new file with mode: 0644]

index b251187813fe1b80a93d86cafb0c21a0c6b1f3dc..69a9eeba469445414aae6a1521ad8662e2538edd 100644 (file)
@@ -1,3 +1,15 @@
+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
index a00f57885df16ac1d887700fbdd452037fb0745c..8724a19504b1b918fe7657a304cf4d66f1f1791b 100644 (file)
@@ -291,7 +291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
                    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);
index 22538c9fc7a1642fe51124529aa69ea4b432d784..e90d9574cd26cd9e2d70e4fba2b8e4fd3750e908 100644 (file)
@@ -312,7 +312,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
         iterator __first1 = begin();
         iterator __last1 = end();
         for (; __first1 != __last1 && __first2 != __last2;
-            ++__first1, ++__first2)
+            ++__first1, (void)++__first2)
           *__first1 = *__first2;
         if (__first2 == __last2)
           erase(__first1, __last1);
index de723edf50c509e1a1d1e234a4735b5743af626e..24594044d7ac92b5835682fffe0063f682a7272d 100644 (file)
@@ -1221,7 +1221,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
                      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);
index fb6d7e009895063ba3f1c5fe69995153bf9d056a..1d1ef427b26d99a4d817c3dfeb10f8a4374d520e 100644 (file)
@@ -273,7 +273,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       {
        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);
diff --git a/libstdc++-v3/testsuite/23_containers/deque/modifiers/assign/1.cc b/libstdc++-v3/testsuite/23_containers/deque/modifiers/assign/1.cc
new file mode 100644 (file)
index 0000000..fbab09b
--- /dev/null
@@ -0,0 +1,36 @@
+// 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;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/assign/1.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/assign/1.cc
new file mode 100644 (file)
index 0000000..c5fde47
--- /dev/null
@@ -0,0 +1,36 @@
+// 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;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/assign/1.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/assign/1.cc
new file mode 100644 (file)
index 0000000..833201b
--- /dev/null
@@ -0,0 +1,41 @@
+// 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;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/assign/1.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/assign/1.cc
new file mode 100644 (file)
index 0000000..ca7b125
--- /dev/null
@@ -0,0 +1,41 @@
+// 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;
+}