From 49721a90e57dfad9c6daab6be36be705360d1d27 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 15 Nov 2016 05:03:22 +0000 Subject: [PATCH] Missed one of the try blocks the first time :-(. Thanks to Renato for the heads up. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286932 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../string.cons/T_size_size.pass.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp b/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp index 144a1ab1f..0b75a6cf0 100644 --- a/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp +++ b/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp @@ -64,7 +64,7 @@ test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a) { typedef typename S::traits_type T; typedef typename S::allocator_type A; - try + if (pos <= sv.size()) { S s2(sv, pos, n, a); LIBCPP_ASSERT(s2.__invariants()); @@ -75,10 +75,20 @@ test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a) assert(s2.get_allocator() == a); assert(s2.capacity() >= s2.size()); } - catch (std::out_of_range&) +#ifndef TEST_HAS_NO_EXCEPTIONS + else { - assert(pos > sv.size()); + try + { + S s2(sv, pos, n, a); + assert(false); + } + catch (std::out_of_range&) + { + assert(pos > sv.size()); + } } +#endif } int main()