diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:58 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:58 +0000 |
commit | 53a420fba21cf1644972b34dcd811a43cdb8368d (patch) | |
tree | 66a19f6f8b65215772549a51d688492ab8addc0d /test/std/strings/basic.string/string.capacity/reserve.pass.cpp | |
parent | b50f1549701eb950921e5d6f2e55ba1a1dadbb43 (diff) |
Notes
Diffstat (limited to 'test/std/strings/basic.string/string.capacity/reserve.pass.cpp')
-rw-r--r-- | test/std/strings/basic.string/string.capacity/reserve.pass.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/test/std/strings/basic.string/string.capacity/reserve.pass.cpp b/test/std/strings/basic.string/string.capacity/reserve.pass.cpp index b2c254d1fb253..7210152ea3cb1 100644 --- a/test/std/strings/basic.string/string.capacity/reserve.pass.cpp +++ b/test/std/strings/basic.string/string.capacity/reserve.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // <string> // void reserve(size_type res_arg=0); @@ -37,19 +36,29 @@ void test(S s, typename S::size_type res_arg) { typename S::size_type old_cap = s.capacity(); + ((void)old_cap); // Prevent unused warning S s0 = s; - try + if (res_arg <= s.max_size()) { s.reserve(res_arg); - assert(res_arg <= s.max_size()); assert(s == s0); assert(s.capacity() >= res_arg); assert(s.capacity() >= s.size()); } - catch (std::length_error&) +#ifndef TEST_HAS_NO_EXCEPTIONS + else { - assert(res_arg > s.max_size()); + try + { + s.reserve(res_arg); + assert(false); + } + catch (std::length_error&) + { + assert(res_arg > s.max_size()); + } } +#endif } int main() |