diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp --- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp @@ -34,26 +34,39 @@ // generic_string forwards to string. Tests for -// string() are in "path.native.op/string_alloc.pass.cpp". +// string() are in "path.native.obs/string_alloc.pass.cpp". // generic_string is minimally tested here. -int main(int, char**) +template +void doAllocTest() { using namespace fs; - using CharT = wchar_t; using Traits = std::char_traits; using Alloc = malloc_allocator; using Str = std::basic_string; - const wchar_t* expect = longString; + const CharT* expect = longString; const path p((const char*)longString); { - DisableAllocationGuard g; + // On Windows, charset conversions cause allocations outside of the + // provided allocator. + TEST_NOT_WIN32(DisableAllocationGuard g); Alloc a; Alloc::disable_default_constructor = true; - Str s = p.generic_string(a); + Str s = p.generic_string(a); assert(s == expect); assert(Alloc::alloc_count > 0); assert(Alloc::outstanding_alloc() == 1); + Alloc::disable_default_constructor = false; } +} +int main(int, char**) +{ + doAllocTest(); + doAllocTest(); + doAllocTest(); + doAllocTest(); +#if TEST_STD_VER > 17 && defined(__cpp_lib_char8_t) + doAllocTest(); +#endif return 0; } diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp --- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp @@ -150,6 +150,9 @@ doShortStringTest(S); doShortStringTest(S); doShortStringTest(S); +#if TEST_STD_VER > 17 && defined(__cpp_lib_char8_t) + doShortStringTest(S); +#endif } { auto const& S = longString; @@ -157,6 +160,9 @@ doLongStringTest(S); doLongStringTest(S); doLongStringTest(S); +#if TEST_STD_VER > 17 && defined(__cpp_lib_char8_t) + doLongStringTest(S); +#endif } return 0;