]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fixed signed comparision in _M_parse_fill_and_align [PR119840]
authorTomasz Kamiński <tkaminsk@redhat.com>
Thu, 17 Apr 2025 08:33:10 +0000 (10:33 +0200)
committerTomasz Kamiński <tkaminsk@redhat.com>
Thu, 17 Apr 2025 09:56:58 +0000 (11:56 +0200)
Explicitly cast elements of __not_fill to _CharT. Only '{' and ':'
are used as `__not_fill`, so they are never negative.

PR libstdc++/119840

libstdc++-v3/ChangeLog:

* include/std/format (_M_parse_fill_and_align): Cast elements of
__not_fill to _CharT.

libstdc++-v3/include/std/format

index f3fd837897bd17b4e2c08cb2970cd599c4445e7d..e557e104d74d083dcc38c4ec4533b6930a1a61c1 100644 (file)
@@ -555,8 +555,8 @@ namespace __format
       constexpr iterator
       _M_parse_fill_and_align(iterator __first, iterator __last, string_view __not_fill) noexcept
       {
-       for (char c : __not_fill)
-         if (*__first == c)
+       for (char __c : __not_fill)
+         if (*__first == static_cast<_CharT>(__c))
            return __first;
 
        using namespace __unicode;