https://gcc.gnu.org/g:3f2a291ef3a5bbf854454f2d2c8559d9f4cb292a
commit r16-4263-g3f2a291ef3a5bbf854454f2d2c8559d9f4cb292a Author: Jonathan Wakely <[email protected]> Date: Wed Oct 1 13:31:59 2025 +0100 libstdc++: Fix -Wformat warning in std::string The __throw_out_of_range_fmt function works like fprintf and so the arguments corresponding to %zu specifiers need to be size_t. The std::basic_string<C,T,A>::size_type type is A::size_type which is not necessarily size_t. Add explicit casts to avoid a -Wformat warning with -Wsystem-headers. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (basic_string::_M_check): Cast size_type arguments to size_t. Diff: --- libstdc++-v3/include/bits/basic_string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 708104984d2d..8ae6569f5016 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -411,7 +411,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 if (__pos > this->size()) __throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > " "this->size() (which is %zu)"), - __s, __pos, this->size()); + __s, (size_t)__pos, (size_t)this->size()); return __pos; }
