From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 2E3A63857437; Wed, 12 Jul 2023 20:04:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E3A63857437 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689192278; bh=CeK0EkJ3xWG0KBVs5w9U8Izh5qS2KbeFwn0kqnQkAhE=; h=From:To:Subject:Date:From; b=BSRb+Kp7Uu4UXm9lMbjz6i/MkkwZBCzXg3eaWMjJ2JgAXbzCZSefg2vIgDVPVnuMW idQ2rOUX157u50gcy+KVLei4ustnWiF/5499MO42A9TnjXCJjRYGD/W0vKZckKXfYV IaSGERvHoDdzO2BkXB5IRgDnSHyN0Pmu3r0lnlRM= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-2478] libstdc++: Check conversion from filesystem::path to wide strings [PR95048] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 61fe96d4853eb743eebbf98bff24f96fe007a6e1 X-Git-Newrev: d6384ad1a9ab7ea46990a7ed1299d5a2be4acece Message-Id: <20230712200438.2E3A63857437@sourceware.org> Date: Wed, 12 Jul 2023 20:04:38 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d6384ad1a9ab7ea46990a7ed1299d5a2be4acece commit r14-2478-gd6384ad1a9ab7ea46990a7ed1299d5a2be4acece Author: Jonathan Wakely Date: Wed Jul 12 14:40:19 2023 +0100 libstdc++: Check conversion from filesystem::path to wide strings [PR95048] The testcase added for this bug only checks conversion from wide strings on construction, but the fix also covered conversion to wide stings via path::wstring(). Add checks for that, and u16string() and u32string(). libstdc++-v3/ChangeLog: PR libstdc++/95048 * testsuite/27_io/filesystem/path/construct/95048.cc: Check conversions to wide strings. * testsuite/experimental/filesystem/path/construct/95048.cc: Likewise. Diff: --- libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc | 6 ++++++ .../testsuite/experimental/filesystem/path/construct/95048.cc | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc index c1a382d1420..cd80d668b23 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/95048.cc @@ -16,6 +16,8 @@ test_wide() VERIFY( CHECK(L, "\U0001F4C1") ); // folder VERIFY( CHECK(L, "\U0001F4C2") ); // open folder VERIFY( CHECK(L, "\U0001F4C4") ); // filing cabient + + VERIFY( path(u8"\U0001D11E").wstring() == L"\U0001D11E" ); // G Clef } void @@ -25,6 +27,8 @@ test_u16() VERIFY( CHECK(u, "\U0001F4C1") ); // folder VERIFY( CHECK(u, "\U0001F4C2") ); // open folder VERIFY( CHECK(u, "\U0001F4C4") ); // filing cabient + + VERIFY( path(u8"\U0001D11E").u16string() == u"\U0001D11E" ); // G Clef } void @@ -34,6 +38,8 @@ test_u32() VERIFY( CHECK(U, "\U0001F4C1") ); // folder VERIFY( CHECK(U, "\U0001F4C2") ); // open folder VERIFY( CHECK(U, "\U0001F4C4") ); // filing cabient + + VERIFY( path(u8"\U0001D11E").u32string() == U"\U0001D11E" ); // G Clef } int diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/95048.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/95048.cc index b7a93f3c985..fc65bfecd4d 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/95048.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/95048.cc @@ -18,6 +18,8 @@ test_wide() VERIFY( CHECK(L, "\U0001F4C1") ); // folder VERIFY( CHECK(L, "\U0001F4C2") ); // open folder VERIFY( CHECK(L, "\U0001F4C4") ); // filing cabient + + VERIFY( path(u8"\U0001D11E").wstring() == L"\U0001D11E" ); // G Clef } void @@ -27,6 +29,8 @@ test_u16() VERIFY( CHECK(u, "\U0001F4C1") ); // folder VERIFY( CHECK(u, "\U0001F4C2") ); // open folder VERIFY( CHECK(u, "\U0001F4C4") ); // filing cabient + + VERIFY( path(u8"\U0001D11E").u16string() == u"\U0001D11E" ); // G Clef } void @@ -36,6 +40,8 @@ test_u32() VERIFY( CHECK(U, "\U0001F4C1") ); // folder VERIFY( CHECK(U, "\U0001F4C2") ); // open folder VERIFY( CHECK(U, "\U0001F4C4") ); // filing cabient + + VERIFY( path(u8"\U0001D11E").u32string() == U"\U0001D11E" ); // G Clef } int