summaryrefslogtreecommitdiffstats
path: root/libcxx/test/strings/basic.string
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/strings/basic.string')
-rw-r--r--libcxx/test/strings/basic.string/test_allocator.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/libcxx/test/strings/basic.string/test_allocator.h b/libcxx/test/strings/basic.string/test_allocator.h
index 001ca98bd67..89852159d3c 100644
--- a/libcxx/test/strings/basic.string/test_allocator.h
+++ b/libcxx/test/strings/basic.string/test_allocator.h
@@ -48,8 +48,13 @@ public:
const_pointer address(const_reference x) const {return &x;}
pointer allocate(size_type n, const void* = 0)
{
- if (count >= throw_after)
+ if (count >= throw_after) {
+#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_alloc();
+#else
+ std::terminate();
+#endif
+ }
++count;
return (pointer)std::malloc(n * sizeof(T));
}
OpenPOWER on IntegriCloud