// Test that it's possible to take the address of basic_string's destructors
// by creating globals which will register their destructors with cxa_atexit.
-std::string s;
+std::string unused_string;
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
-std::wstring ws;
+std::wstring unused_wide_string;
#endif
static_assert(std::is_nothrow_destructible<std::string>::value, "");
{
std::basic_string<char, std::char_traits<char>, test_allocator<char>> str2((test_allocator<char>(&alloc_stats)));
str2 = "long long string so no SSO";
- assert(alloc_stats.alloc_count == 1);
+ assert(alloc_stats.alloc_count > 0);
+ LIBCPP_ASSERT(alloc_stats.alloc_count == 1);
}
assert(alloc_stats.alloc_count == 0);
// constexpr basic_string substr(size_type pos = 0, size_type n = npos) &&;
#include <algorithm>
+#include <stdexcept>
#include <string>
#include "constexpr_char_traits.h"
} should_throw_exception;
template <class S>
-constexpr void test(S orig, size_t pos, ptrdiff_t n, S expected) {
+constexpr void test(S orig, typename S::size_type pos, typename S::size_type n, const S expected) {
S str = std::move(orig).substr(pos, n);
LIBCPP_ASSERT(orig.__invariants());
LIBCPP_ASSERT(str.__invariants());
}
template <class S>
-constexpr void test(S orig, size_t pos, ptrdiff_t n, should_throw_exception_t) {
+constexpr void test(S orig, typename S::size_type pos, typename S::size_type n, should_throw_exception_t) {
#ifndef TEST_HAS_NO_EXCEPTIONS
if (!std::is_constant_evaluated()) {
try {