From 714902c8d41b98d1254a17cae94d9192ee8c7d82 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 5 Mar 2010 01:51:56 +0000 Subject: testsuite_container_traits.h (traits_base): Add has_throwing_erase trait. 2010-03-04 Paolo Carlini * testsuite/util/testsuite_container_traits.h (traits_base): Add has_throwing_erase trait. (traits, traits): 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, traits, traits, traits, traits, traits, traits, traits): Typedef consistently has_erase and has_insert as true_type. * testsuite/util/testsuite_container_traits.h (traits, traits, traits, traits): 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 --- libstdc++-v3/testsuite/util/exception/safety.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libstdc++-v3/testsuite/util/exception') 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::has_throwing_erase::value) + { + _M_erasep(_M_container); + _M_eraser(_M_container); + } _M_popf(_M_container); _M_popb(_M_container); -- cgit v1.1