diff --git a/libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp @@ -29,9 +29,9 @@ // 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::value, ""); @@ -45,7 +45,8 @@ { std::basic_string, test_allocator> str2((test_allocator(&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); diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr_rvalue.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr_rvalue.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr_rvalue.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr_rvalue.pass.cpp @@ -13,6 +13,7 @@ // constexpr basic_string substr(size_type pos = 0, size_type n = npos) &&; #include +#include #include #include "constexpr_char_traits.h" @@ -26,7 +27,7 @@ } should_throw_exception; template -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()); @@ -34,7 +35,7 @@ } template -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 {