public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Disable broken std::format for floating-point types [PR108221]
Date: Fri,  6 Jan 2023 13:26:58 +0000	[thread overview]
Message-ID: <20230106132658.189522-1-jwakely@redhat.com> (raw)

Tested x86_64-linux, built (but not tested) on h8300-elf.

Pushed to trunk.

-- >8 --

If we don't have std::to_chars for floating-point types (either because
float and double are not IEEE format, or size_t is 16-bit) then we can't
use them with std::format. This causes a bootstrap failure since
std/c++20/tzdb.cc was added to the library, because <chrono> now
includes <format>.

This change just disables formatting support for those types. This is
not a proper fix, but solves the bootstrap failure for now.

libstdc++-v3/ChangeLog:

	PR libstdc++/108221
	* include/std/format (basic_format_arg) [!__cpp_lib_to_chars]:
	Disable visiting floating-point types.
---
 libstdc++-v3/include/std/format | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 98421e8c123..77f7c9fef3f 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -3034,6 +3034,7 @@ namespace __format
 	      return std::forward<_Visitor>(__vis)(_M_val._M_ll);
 	    case _Arg_ull:
 	      return std::forward<_Visitor>(__vis)(_M_val._M_ull);
+#if __cpp_lib_to_chars // FIXME: need to be able to format these types!
 	    case _Arg_flt:
 	      return std::forward<_Visitor>(__vis)(_M_val._M_flt);
 	    case _Arg_dbl:
@@ -3046,6 +3047,7 @@ namespace __format
 	      return std::forward<_Visitor>(__vis)(_M_val._M_f128);
 	    case _Arg_ibm128:
 	      return std::forward<_Visitor>(__vis)(_M_val._M_ibm128);
+#endif
 #endif
 	    case _Arg_str:
 	      return std::forward<_Visitor>(__vis)(_M_val._M_str);
-- 
2.39.0


                 reply	other threads:[~2023-01-06 13:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230106132658.189522-1-jwakely@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).