aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2018-05-02 19:51:33 +0000
committerFrançois Dumont <fdumont@gcc.gnu.org>2018-05-02 19:51:33 +0000
commit27db01d8039a1a1664bcd1ebd1f66cedcfe72398 (patch)
treef042570f7ee6b09d19f49069e2394e29bfbf95d4
parent85d0fad46932c6ff6cad0d839157c4290a5f6586 (diff)
downloadgcc-27db01d8039a1a1664bcd1ebd1f66cedcfe72398.zip
gcc-27db01d8039a1a1664bcd1ebd1f66cedcfe72398.tar.gz
gcc-27db01d8039a1a1664bcd1ebd1f66cedcfe72398.tar.bz2
deque.tcc (deque<>::_M_assign_aux): Cast to void to ensure overloaded comma not used.
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
-rw-r--r--libstdc++-v3/ChangeLog12
-rw-r--r--libstdc++-v3/include/bits/deque.tcc2
-rw-r--r--libstdc++-v3/include/bits/list.tcc2
-rw-r--r--libstdc++-v3/include/bits/stl_bvector.h2
-rw-r--r--libstdc++-v3/include/bits/vector.tcc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/modifiers/assign/1.cc36
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/assign/1.cc36
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/assign/1.cc41
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/assign/1.cc41
9 files changed, 170 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b251187..69a9eeb 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc
index a00f578..8724a19 100644
--- a/libstdc++-v3/include/bits/deque.tcc
+++ b/libstdc++-v3/include/bits/deque.tcc
@@ -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);
diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index 22538c9..e90d957 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -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);
diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index de723ed..2459404 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -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);
diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc
index fb6d7e0..1d1ef42 100644
--- a/libstdc++-v3/include/bits/vector.tcc
+++ b/libstdc++-v3/include/bits/vector.tcc
@@ -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
index 0000000..fbab09b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/modifiers/assign/1.cc
@@ -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
index 0000000..c5fde47
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/assign/1.cc
@@ -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
index 0000000..833201b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/assign/1.cc
@@ -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
index 0000000..ca7b125
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/assign/1.cc
@@ -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;
+}