[PATCH] libstdc++: testsuite: Simplify codecvt_unicode

Jonathan Wakely jwakely@redhat.com
Wed Jan 18 18:53:43 GMT 2023


On 17/01/23 22:12 +0100, Dimitrij Mijoski wrote:
>Stop using unique_ptr, create some objects directly.
>
>libstdc++-v3/ChangeLog:
>
>	* testsuite/22_locale/codecvt/codecvt_unicode.cc: Simplify.
>	* testsuite/22_locale/codecvt/codecvt_unicode.h: Simplify.
>	* testsuite/22_locale/codecvt/codecvt_unicode_wchar_t.cc: Simplify.
>---
> .../22_locale/codecvt/codecvt_unicode.cc       | 18 ++++++++++--------
> .../22_locale/codecvt/codecvt_unicode.h        |  9 +--------
> .../codecvt/codecvt_unicode_wchar_t.cc         | 12 ++++++------
> 3 files changed, 17 insertions(+), 22 deletions(-)
>
>diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.cc
>index ae4b6c896..3d7393e4a 100644
>--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.cc
>+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.cc
>@@ -29,11 +29,12 @@ test_utf8_utf32_codecvts ()
>   using codecvt_c32 = codecvt<char32_t, char, mbstate_t>;
>   auto loc_c = locale::classic ();
>   VERIFY (has_facet<codecvt_c32> (loc_c));
>+
>   auto &cvt = use_facet<codecvt_c32> (loc_c);
>   test_utf8_utf32_codecvts (cvt);
>
>-  auto cvt_ptr = to_unique_ptr (new codecvt_utf8<char32_t> ());
>-  test_utf8_utf32_codecvts (*cvt_ptr);
>+  auto cvt2 = codecvt_utf8<char32_t> ();

This doesn't compile in C++11 or C++14, because there's no guaranteed
elision.

I've pushed the attached change instead. Thanks for the patch.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 3927 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20230118/51786297/attachment-0001.bin>


More information about the Gcc-patches mailing list