diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2010-01-08 13:01:24 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2010-01-08 13:01:24 +0000 |
commit | 79667f82adf76d79baf6acfa20df02cf7f14d5fc (patch) | |
tree | 778689ad488b56c1f90d26cb0406c50fc38ecdcd /libstdc++-v3/testsuite/ext/vstring | |
parent | 1eee5628bd63cd0d6d58700f06f431570db29de0 (diff) | |
download | gcc-79667f82adf76d79baf6acfa20df02cf7f14d5fc.zip gcc-79667f82adf76d79baf6acfa20df02cf7f14d5fc.tar.gz gcc-79667f82adf76d79baf6acfa20df02cf7f14d5fc.tar.bz2 |
re PR libstdc++/42573 ([C++0x] shrink_to_fit() missing)
2010-01-08 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/42573
* include/bits/allocator.h (struct __shrink_to_fit): Add.
* include/bits/stl_deque.h (deque<>::shrink_to_fit): Add.
* include/bits/stl_vector.h (vector<>::shrink_to_fit): Likewise.
* include/bits/stl_bvector.h (vector<bool>::shrink_to_fit): Likewise.
* include/bits/basic_string.h (basic_string<>::shrink_to_fit):
Likewise.
* include/ext/vstring.h (__versa_string<>::shrink_to_fit): Likewise.
* include/debug/deque: Add corresponding using declaration.
* include/debug/vector: Likewise.
* include/debug/string: Likewise.
* include/profile/deque: Likewise.
* include/profile/vector: Likewise.
* config/abi/pre/gnu.ver: Export new symbols.
* testsuite/23_containers/deque/capacity/shrink_to_fit.cc: New.
* testsuite/23_containers/vector/capacity/shrink_to_fit.cc: Likewise.
* testsuite/21_strings/basic_string/capacity/char/shrink_to_fit.cc:
Likewise.
* testsuite/21_strings/basic_string/capacity/wchar_t/shrink_to_fit.cc:
Likewise.
* testsuite/ext/vstring/capacity/shrink_to_fit.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* 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/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_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.
From-SVN: r155733
Diffstat (limited to 'libstdc++-v3/testsuite/ext/vstring')
-rw-r--r-- | libstdc++-v3/testsuite/ext/vstring/capacity/shrink_to_fit.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/ext/vstring/capacity/shrink_to_fit.cc b/libstdc++-v3/testsuite/ext/vstring/capacity/shrink_to_fit.cc new file mode 100644 index 0000000..e6737de --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/capacity/shrink_to_fit.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2010 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 Pred 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> +#include <testsuite_hooks.h> + +// libstdc++/42573 +void test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::__vstring vs(100, 'a'); + vs.push_back('b'); + vs.push_back('b'); + VERIFY( vs.size() < vs.capacity() ); + vs.shrink_to_fit(); + VERIFY( vs.size() == vs.capacity() ); +} + +int main() +{ + test01(); + return 0; +} |