diff options
author | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-03-28 16:17:18 +0100 |
---|---|---|
committer | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-03-31 10:56:54 +0200 |
commit | 5f2078ca11843e3fe506c2fb72b9260a3cb9853e (patch) | |
tree | 0cca4e99e3073bb2f040ebee09bb6a825caea616 /gcc | |
parent | 7d126e2bbb378d1344f871011406c08aa88a85cd (diff) | |
download | gcc-5f2078ca11843e3fe506c2fb72b9260a3cb9853e.zip gcc-5f2078ca11843e3fe506c2fb72b9260a3cb9853e.tar.gz gcc-5f2078ca11843e3fe506c2fb72b9260a3cb9853e.tar.bz2 |
libstdc++: Constrain formatters for chrono types [PR119517]
The formatters for chrono types defined the parse/format methods
as accepting unconstrained types, this in combination with lack
of constrain on _CharT lead to them falsely satisfying formattable
requirements for any type used as character.
This patch adjust the fromatter<T, CharT>::parse signature to:
constexpr typename basic_format_parse_context<_CharT>::iterator
parse(basic_format_parse_context<_CharT>& __pc);
And formatter<T, CharT>::format to:
template<typename _Out>
typename basic_format_context<_Out, _CharT>::iterator
format(const T& __t,
basic_format_context<_Out, _CharT>& __fc) const;
Furthermore we _CharT with __format::__char (char or wchar_t),
PR libstdc++/119517
libstdc++-v3/ChangeLog:
* include/bits/chrono_io.h (formatter):
Add __format::__char for _CharT and adjust parse and format
method signatures.
* testsuite/std/time/format/pr119517.cc: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions