From cb0988a659cef6324887018b9066c5f81b558832 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 9 Oct 2024 14:24:19 +0100 Subject: [PATCH] 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. --- libstdc++-v3/testsuite/20_util/duration/io.cc | 10 ++++++++-- libstdc++-v3/testsuite/std/format/parse_ctx_neg.cc | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) 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