diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp index cb579637a27b56..975e96c3031cfb 100644 --- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp @@ -85,8 +85,10 @@ void test_compare_basic() for (auto const & TC : CompareTestCases) { const path p1(TC.LHS); const path p2(TC.RHS); - const std::string R(TC.RHS); - const std::string_view RV(TC.RHS); + std::string RHS(TC.RHS); + const path::string_type R(RHS.begin(), RHS.end()); + const std::basic_string_view RV(R); + const path::value_type *Ptr = R.c_str(); const int E = TC.expect; { // compare(...) functions DisableAllocationGuard g; // none of these operations should allocate @@ -94,7 +96,7 @@ void test_compare_basic() // check runtime results int ret1 = normalize_ret(p1.compare(p2)); int ret2 = normalize_ret(p1.compare(R)); - int ret3 = normalize_ret(p1.compare(TC.RHS)); + int ret3 = normalize_ret(p1.compare(Ptr)); int ret4 = normalize_ret(p1.compare(RV)); g.release();