[PATCH] libstdc++: Remove unnecessary string in filesystem::path formatter

Tomasz Kamiński tkaminsk@redhat.com
Fri Mar 6 07:07:30 GMT 2026


libstdc++-v3/ChangeLog:

	* include/bits/fs_path.h (std::formatter<filesystem::path, _CharT>):
	Format _Utf_view directly via __formatter_str::_M_format_range.
---
I have forgotten about this during review.

Tested on x86_64-linux. OK for trunk?

 libstdc++-v3/include/bits/fs_path.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h
index 5c0d5c9d5f1..313c64bac43 100644
--- a/libstdc++-v3/include/bits/fs_path.h
+++ b/libstdc++-v3/include/bits/fs_path.h
@@ -1543,9 +1543,8 @@ template<>
 		  __sv = __sink.view();
 		  __spec._M_debug = 0;
 		}
-	      basic_string<_CharT> __out_str
-	        (std::from_range, __unicode::_Utf_view<_CharT, _ViewT>(__sv));
-	      return _FmtStrT(__spec).format(__out_str, __fc);
+	      return _FmtStrT(__spec)._M_format_range(
+		       __unicode::_Utf_view<_CharT, _ViewT>(__sv), __fc);
 	    }
 	}
 
-- 
2.53.0



More information about the Libstdc++ mailing list