diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2013-05-10 15:18:33 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-05-10 15:18:33 +0000 |
commit | 94938aec1ab1996c4554fd3703708052144a784b (patch) | |
tree | 733216f9d05ef2101674b95a354adc2ed369f93c /libstdc++-v3/testsuite | |
parent | 341427fa2da0894f3f9d6966aa802ad237bffe3a (diff) | |
download | gcc-94938aec1ab1996c4554fd3703708052144a784b.zip gcc-94938aec1ab1996c4554fd3703708052144a784b.tar.gz gcc-94938aec1ab1996c4554fd3703708052144a784b.tar.bz2 |
re PR libstdc++/54577 (deque<T>::erase() still takes iterator instead of const_iterator)
2013-05-10 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/54577
* include/bits/stl_deque.h (erase): Fix signatures in C++11 mode.
(_Deque_iterator<>::_M_const_cast): Add.
(deque<>::_M_erase): Declare.
* include/bits/deque.tcc: ... and define.
* include/bits/stl_list.h (erase): Fix signatures in C++11 mode.
(_List_const_iterator<>::_M_const_cast): Add.
* include/bits/list.tcc (erase (iterator)): Fix.
* include/bits/stl_iterator.h (__normal_iterator<>::_M_const_cast):
Add; include <ext/cast.h>.
* include/bits/stl_vector.h (erase): Fix signatures in C++11 mode.
(vector<>::_M_erase): Declare.
* include/bits/stl_bvector.h: Likewise.
* include/bits/vector.tcc (vector<>::_M_erase): Define.
* include/ext/vstring.h (erase): Fix signatures in C++11 mode.
* include/debug/deque: Adjust.
* include/debug/list: Likewise.
* include/debug/vector: Likewise.
* include/profile/deque: Likewise.
* include/profile/list: Likewise.
* include/profile/vector: Likewise.
* testsuite/util/exception/safety.h (erase_base<deque>,
erase_base<deque>, erase_base<vector>): Remove.
(erase_base<__versa_string>): Update.
* testsuite/ext/vstring/modifiers/char/54577.cc: New.
* testsuite/ext/vstring/modifiers/wchar_t/54577.cc: Likewise.
* testsuite/23_containers/deque/modifiers/erase/54577.cc: Likewise.
* testsuite/23_containers/list/modifiers/erase/54577.cc: Likewise.
* testsuite/23_containers/vector/bool/modifiers/erase/54577.cc:
Likewise.
* testsuite/23_containers/vector/modifiers/erase/54577.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line numbers.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_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.
* testsuite/23_containers/list/requirements/dr438/
insert_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
From-SVN: r198790
Diffstat (limited to 'libstdc++-v3/testsuite')
19 files changed, 214 insertions, 56 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/54577.cc b/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/54577.cc new file mode 100644 index 0000000..9553e11 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/54577.cc @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2013 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> + +void test01() +{ + std::deque<int> d1; + d1.push_back(1); + d1.erase(d1.cbegin()); + + std::deque<int> d2; + d2.push_back(2); + d2.push_back(3); + d2.erase(d2.cbegin(), d2.cend()); +} diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc index e360c46..ccb63ef 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1698 } +// { dg-error "no matching" "" { target *-*-* } 1714 } #include <deque> diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc index 814620f..0a5db63 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1631 } +// { dg-error "no matching" "" { target *-*-* } 1647 } #include <deque> diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc index 3cf7ed0..7572322 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1631 } +// { dg-error "no matching" "" { target *-*-* } 1647 } #include <deque> #include <utility> diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc index 358791e..b109d38 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1782 } +// { dg-error "no matching" "" { target *-*-* } 1798 } #include <deque> diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/erase/54577.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/erase/54577.cc new file mode 100644 index 0000000..7df79fb --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/erase/54577.cc @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2013 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> + +void test01() +{ + std::list<int> l1; + l1.push_back(1); + l1.erase(l1.cbegin()); + + std::list<int> l2; + l2.push_back(2); + l2.push_back(3); + l2.erase(l2.cbegin(), l2.cend()); +} 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 63216cb..4ccd652 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 *-*-* } 1529 } +// { dg-error "no matching" "" { target *-*-* } 1545 } #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 bff5fb7..6bc01b7 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 *-*-* } 1481 } +// { dg-error "no matching" "" { target *-*-* } 1497 } #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 45e8905..1f39056 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 *-*-* } 1481 } +// { dg-error "no matching" "" { target *-*-* } 1497 } #include <list> #include <utility> 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 d34465a..902f55a 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 *-*-* } 1481 } +// { dg-error "no matching" "" { target *-*-* } 1497 } #include <list> diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/erase/54577.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/erase/54577.cc new file mode 100644 index 0000000..ed18f6a --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/erase/54577.cc @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2013 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> + +void test01() +{ + std::vector<bool> vb1; + vb1.push_back(true); + vb1.erase(vb1.cbegin()); + + std::vector<bool> vb2; + vb2.push_back(false); + vb2.push_back(true); + vb2.erase(vb2.cbegin(), vb2.cend()); +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/54577.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/54577.cc new file mode 100644 index 0000000..64a87ea --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/54577.cc @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2013 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> + +void test01() +{ + std::vector<int> v1; + v1.push_back(1); + v1.erase(v1.cbegin()); + + std::vector<int> v2; + v2.push_back(2); + v2.push_back(3); + v2.erase(v2.cbegin(), v2.cend()); +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc index 64e4665..2dbc602 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1240 } +// { dg-error "no matching" "" { target *-*-* } 1252 } #include <vector> diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc index b4e881d..7fc56bd 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1166 } +// { dg-error "no matching" "" { target *-*-* } 1178 } #include <vector> diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc index 74bea14..6a37461 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1166 } +// { dg-error "no matching" "" { target *-*-* } 1178 } #include <vector> #include <utility> diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc index a8d98cb..3f5abb9 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1281 } +// { dg-error "no matching" "" { target *-*-* } 1293 } #include <vector> diff --git a/libstdc++-v3/testsuite/ext/vstring/modifiers/char/54577.cc b/libstdc++-v3/testsuite/ext/vstring/modifiers/char/54577.cc new file mode 100644 index 0000000..979828b --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/modifiers/char/54577.cc @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2013 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 <ext/vstring.h> + +void test01() +{ + __gnu_cxx::__vstring vs1; + vs1.push_back('1'); + vs1.erase(vs1.cbegin()); + + __gnu_cxx::__vstring vs2; + vs2.push_back('2'); + vs2.push_back('3'); + vs2.erase(vs2.cbegin(), vs2.cend()); +} diff --git a/libstdc++-v3/testsuite/ext/vstring/modifiers/wchar_t/54577.cc b/libstdc++-v3/testsuite/ext/vstring/modifiers/wchar_t/54577.cc new file mode 100644 index 0000000..f514099 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/modifiers/wchar_t/54577.cc @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2013 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 <ext/vstring.h> + +void test01() +{ + __gnu_cxx::__wvstring wvs1; + wvs1.push_back(L'1'); + wvs1.erase(wvs1.cbegin()); + + __gnu_cxx::__wvstring wvs2; + wvs2.push_back(L'2'); + wvs2.push_back(L'3'); + wvs2.erase(wvs2.cbegin(), wvs2.cend()); +} diff --git a/libstdc++-v3/testsuite/util/exception/safety.h b/libstdc++-v3/testsuite/util/exception/safety.h index 7903236..c063c9b 100644 --- a/libstdc++-v3/testsuite/util/exception/safety.h +++ b/libstdc++-v3/testsuite/util/exception/safety.h @@ -287,51 +287,11 @@ namespace __gnu_test typedef __gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4> container_type; typedef typename container_type::iterator iterator; + typedef typename container_type::const_iterator const_iterator; - iterator (container_type::* _F_erase_point)(iterator); - iterator (container_type::* _F_erase_range)(iterator, iterator); - - erase_base() - : _F_erase_point(&container_type::erase), - _F_erase_range(&container_type::erase) { } - }; - - template<typename _Tp1, typename _Tp2> - struct erase_base<std::deque<_Tp1, _Tp2>> - { - typedef std::deque<_Tp1, _Tp2> container_type; - typedef typename container_type::iterator iterator; - - iterator (container_type::* _F_erase_point)(iterator); - iterator (container_type::* _F_erase_range)(iterator, iterator); - - erase_base() - : _F_erase_point(&container_type::erase), - _F_erase_range(&container_type::erase) { } - }; - - template<typename _Tp1, typename _Tp2> - struct erase_base<std::list<_Tp1, _Tp2>> - { - typedef std::list<_Tp1, _Tp2> container_type; - typedef typename container_type::iterator iterator; - - iterator (container_type::* _F_erase_point)(iterator); - iterator (container_type::* _F_erase_range)(iterator, iterator); - - erase_base() - : _F_erase_point(&container_type::erase), - _F_erase_range(&container_type::erase) { } - }; - - template<typename _Tp1, typename _Tp2> - struct erase_base<std::vector<_Tp1, _Tp2>> - { - typedef std::vector<_Tp1, _Tp2> container_type; - typedef typename container_type::iterator iterator; - - iterator (container_type::* _F_erase_point)(iterator); - iterator (container_type::* _F_erase_range)(iterator, iterator); + iterator (container_type::* _F_erase_point)(const_iterator); + iterator (container_type::* _F_erase_range)(const_iterator, + const_iterator); erase_base() : _F_erase_point(&container_type::erase), |