aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/util/exception
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2010-03-05 01:51:56 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-03-05 01:51:56 +0000
commit714902c8d41b98d1254a17cae94d9192ee8c7d82 (patch)
treec991893918a37695a0f5bf9ecd2333d472922937 /libstdc++-v3/testsuite/util/exception
parent630e6f1be53c41d0d17ece3b9d1167af0c561f84 (diff)
downloadgcc-714902c8d41b98d1254a17cae94d9192ee8c7d82.zip
gcc-714902c8d41b98d1254a17cae94d9192ee8c7d82.tar.gz
gcc-714902c8d41b98d1254a17cae94d9192ee8c7d82.tar.bz2
testsuite_container_traits.h (traits_base): Add has_throwing_erase trait.
2010-03-04 Paolo Carlini <paolo.carlini@oracle.com> * testsuite/util/testsuite_container_traits.h (traits_base): Add has_throwing_erase trait. (traits<vector>, traits<deque>): Typedef the latter to true_type. * testsuite/util/exception/safety.h (generation_prohibited): Do not test vector::erase and deque::erase: can throw if either copy constructor or assignment operator of value_type throws. * testsuite/23_containers/vector/requirements/exception/ generation_prohibited.cc: Remove xfail. * testsuite/23_containers/deque/requirements/exception/ generation_prohibited.cc: Likewise. * include/ext/throw_allocator.h (hash<__gnu_cxx::throw_value_limit>:: operator(), hash<__gnu_cxx::throw_value_random>::operator()): Pass argument by const ref. * testsuite/util/testsuite_container_traits.h (traits<map>, traits<multimap>, traits<set>, traits<multiset>, traits<unordered_map>, traits<unordered_multimap>, traits<unordered_set>, traits<unordered_multiset>): Typedef consistently has_erase and has_insert as true_type. * testsuite/util/testsuite_container_traits.h (traits<unordered_map>, traits<unordered_multimap>, traits<unordered_set>, traits<unordered_multiset>): Do not wrongly typedef has_size_type_constructor as true_type: the constructor accepting a size_type actually gets the initial number of buckets. From-SVN: r157239
Diffstat (limited to 'libstdc++-v3/testsuite/util/exception')
-rw-r--r--libstdc++-v3/testsuite/util/exception/safety.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/libstdc++-v3/testsuite/util/exception/safety.h b/libstdc++-v3/testsuite/util/exception/safety.h
index 2bd1ed9..a17b755 100644
--- a/libstdc++-v3/testsuite/util/exception/safety.h
+++ b/libstdc++-v3/testsuite/util/exception/safety.h
@@ -1096,8 +1096,13 @@ namespace __gnu_test
{
condition_type::always_adjustor on;
- _M_erasep(_M_container);
- _M_eraser(_M_container);
+ // NB: Vector and deque are special, erase can throw if the copy
+ // constructor or assignment operator of value_type throws.
+ if (!traits<container_type>::has_throwing_erase::value)
+ {
+ _M_erasep(_M_container);
+ _M_eraser(_M_container);
+ }
_M_popf(_M_container);
_M_popb(_M_container);