]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix -Wformat warning in std::string
authorJonathan Wakely <jwakely@redhat.com>
Wed, 1 Oct 2025 12:31:59 +0000 (13:31 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 7 Oct 2025 11:11:21 +0000 (12:11 +0100)
commit3f2a291ef3a5bbf854454f2d2c8559d9f4cb292a
tree86436e926ee292068fbd85824be53a13b3b95a10
parentbb23a04417f07e7dce19dd94b803556f07a61720
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.
libstdc++-v3/include/bits/basic_string.h