From a3186d4e6000224e2eee485c4e47145528c6ece1 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 13 Oct 2004 00:11:14 +0000 Subject: [PATCH] [multiple changes] 2004-10-12 Paolo Carlini PR libstdc++/17948 * include/bits/stl_tree.h (erase(iterator, iterator)): Revert wrong commit of 2004-10-07. 2004-10-12 Scott Snyder PR libstdc++/17948 * testsuite/23_containers/set/modifiers/17948.cc: New. From-SVN: r88956 --- libstdc++-v3/ChangeLog | 11 +++++ libstdc++-v3/include/bits/stl_tree.h | 4 +- .../23_containers/set/modifiers/17948.cc | 45 +++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/17948.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f736c640fa8..7a11af91efb 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2004-10-12 Paolo Carlini + + PR libstdc++/17948 + * include/bits/stl_tree.h (erase(iterator, iterator)): Revert + wrong commit of 2004-10-07. + +2004-10-12 Scott Snyder + + PR libstdc++/17948 + * testsuite/23_containers/set/modifiers/17948.cc: New. + 2004-10-11 Benjamin Kosnik * include/bits/stl_deque.h: Correct for over-long lines. diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 0b47dd2de73..e2442f09c46 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -1087,8 +1087,8 @@ namespace std if (__first == begin() && __last == end()) clear(); else - for (; __first != __last; ++__first) - erase(__first); + while (__first != __last) + erase(__first++); } template +#include + +// libstdc++/17948 +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + typedef set::size_type size_type; + + set s; + + s.insert(2); + s.insert(3); + + size_type x = s.erase(3); + + VERIFY( s.size() == 1 ); + VERIFY( x == 1 ); +} + +int main () +{ + test01(); + return 0; +} -- 2.30.2