]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Replace non-type-dependent uses of wchar_t in <format> and <chrono>
authorJonathan Wakely <jwakely@redhat.com>
Fri, 18 Aug 2023 10:28:32 +0000 (11:28 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 18 Aug 2023 10:56:57 +0000 (11:56 +0100)
commit6fabf8f25772bf7a7ff68a31a315cd91b86a186e
tree33bf6793b352ada442a171e3c9e0a221883faf34
parent8353b9c5f5af0e65cb04fcbb7325d6a566006cd4
libstdc++: Replace non-type-dependent uses of wchar_t in <format> and <chrono>

This is one more piece of the rework to make wchar_t support in
std::format depend on _GLIBCXX_USE_WCHAR_T.

In <format> the __to_wstring_numeric function is called with arguments
that aren't type-dependent, so a declaration needs to be available, or
the calls need to be guarded by _GLIBCXX_USE_WCHAR_T.

In <chrono> there is a similarly non-type-dependent call to std::format
with a wchar_t format string, which is ill-formed when the wchar_t
overloads of std::format are not declared. Use _GLIBCXX_WIDEN to make it
type-dependent.

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (operator<<): Make uses of wide
strings with streams and std::format type-dependent on _CharT.
* include/std/format [!_GLIBCXX_USE_WCHAR_T] Do not use
__to_wstring_numeric.
libstdc++-v3/include/bits/chrono_io.h
libstdc++-v3/include/std/format