[gcc r15-9876] libstdc++: Report compilation error on formatting "%d" from month_last [PR120650]
Tomasz Kaminski
tkaminsk@gcc.gnu.org
Mon Jun 30 14:02:29 GMT 2025
https://gcc.gnu.org/g:53d2ca1541b34bb2f840d5aede9b826025dd0bb7
commit r15-9876-g53d2ca1541b34bb2f840d5aede9b826025dd0bb7
Author: Tomasz Kamiński <tkaminsk@redhat.com>
Date: Tue Jun 24 09:17:12 2025 +0200
libstdc++: Report compilation error on formatting "%d" from month_last [PR120650]
For month_day we incorrectly reported day information to be available, which lead
to format_error being thrown from the call to formatter::format at runtime, instead
of making call to format ill-formed.
PR libstdc++/120650
libstdc++-v3/ChangeLog:
* include/bits/chrono_io.h
(formatter<chrono::month_day_last,_CharT>::parse): Call _M_parse with
only Month being available.
(cherry picked from commit 190aaaaf077fe5f318e168a7a1e1aa57058f377e)
Diff:
---
libstdc++-v3/include/bits/chrono_io.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h
index 32ef3533c720..e9e6a440efb2 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -1905,7 +1905,7 @@ namespace __format
{
constexpr typename basic_format_parse_context<_CharT>::iterator
parse(basic_format_parse_context<_CharT>& __pc)
- { return _M_f._M_parse(__pc, __format::_Month|__format::_Day); }
+ { return _M_f._M_parse(__pc, __format::_Month); }
template<typename _Out>
typename basic_format_context<_Out, _CharT>::iterator
More information about the Libstdc++-cvs
mailing list