From: Jonathan Wakely Date: Wed, 9 Oct 2024 13:24:19 +0000 (+0100) Subject: libstdc++: Fix some test failures with -fno-char8_t X-Git-Tag: basepoints/gcc-16~5306 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cb0988a659cef6324887018b9066c5f81b558832;p=thirdparty%2Fgcc.git libstdc++: Fix some test failures with -fno-char8_t libstdc++-v3/ChangeLog: * testsuite/20_util/duration/io.cc [!__cpp_lib_char8_t]: Define char8_t as a typedef for unsigned char. * testsuite/std/format/parse_ctx_neg.cc: Skip for -fno-char8_t. --- diff --git a/libstdc++-v3/testsuite/20_util/duration/io.cc b/libstdc++-v3/testsuite/20_util/duration/io.cc index 383fb60afe2..0117673dbdc 100644 --- a/libstdc++-v3/testsuite/20_util/duration/io.cc +++ b/libstdc++-v3/testsuite/20_util/duration/io.cc @@ -5,6 +5,10 @@ #include #include +#ifndef __cpp_lib_char8_t +using char8_t = unsigned char; // Prevent errors if -fno-char8_t is used. +#endif + void test01() { @@ -173,12 +177,14 @@ test_format() #if __cplusplus > 202002L static_assert( ! std::formattable, char> ); - static_assert( ! std::formattable, char> ); static_assert( ! std::formattable, char> ); static_assert( ! std::formattable, char> ); - static_assert( ! std::formattable, wchar_t> ); static_assert( ! std::formattable, wchar_t> ); static_assert( ! std::formattable, wchar_t> ); +#ifdef __cpp_lib_char8_t + static_assert( ! std::formattable, char> ); + static_assert( ! std::formattable, wchar_t> ); +#endif #endif } diff --git a/libstdc++-v3/testsuite/std/format/parse_ctx_neg.cc b/libstdc++-v3/testsuite/std/format/parse_ctx_neg.cc index d6a4366d7d0..f19107c886f 100644 --- a/libstdc++-v3/testsuite/std/format/parse_ctx_neg.cc +++ b/libstdc++-v3/testsuite/std/format/parse_ctx_neg.cc @@ -1,4 +1,5 @@ // { dg-do compile { target c++26 } } +// { dg-skip-if "" { *-*-* } { "-fno-char8_t" } } #include