[gcc r15-9788] libstdc++: Fix format call in formatting with empty specs for durations.

Tomasz Kaminski tkaminsk@gcc.gnu.org
Fri Jun 6 11:57:34 GMT 2025


https://gcc.gnu.org/g:b2338ebf3e698589c69a521b4b4a7908dd959751

commit r15-9788-gb2338ebf3e698589c69a521b4b4a7908dd959751
Author: Tomasz Kamiński <tkaminsk@redhat.com>
Date:   Wed Jun 4 11:05:11 2025 +0200

    libstdc++: Fix format call in formatting with empty specs for durations.
    
    This patches fixes an obvious error, where the output iterator argument was
    missing for call to format_to, when duration with custom representation types
    are used.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/chrono_io.h (__formatter_chrono:_M_s): Add missing
            __out argument to format_to call.
    
    Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
    Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
    (cherry picked from commit ac0a04b7a254fb8e1d8d7088336bcb4375807b1e)

Diff:
---
 libstdc++-v3/include/bits/chrono_io.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h
index 7ab989f59a1c..32ef3533c720 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -1318,7 +1318,8 @@ namespace __format
 		  else
 		    {
 		      auto __str = std::format(_S_empty_spec, __ss.count());
-		      __out = std::format_to(_GLIBCXX_WIDEN("{:0>{}s}"),
+		      __out = std::format_to(std::move(__out),
+					     _GLIBCXX_WIDEN("{:0>{}s}"),
 					     __str,
 					     __hms.fractional_width);
 		    }


More information about the Libstdc++-cvs mailing list