This avoids a runtime error from Clang's annoying -fsanitize=integer
(even though it's not undefined and behaves correctly).

libstdc++-v3/ChangeLog:

        PR libstdc++/119429
        * include/std/format (__format::_Scanner::_Scanner): Cast
        default argument to size_t.
---

Tested x86_64-linux.

Reluctantly pushed to trunk. I continue to dislike this sanitizer.

 libstdc++-v3/include/std/format | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 1b38913359d..c3327e1d384 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -4051,7 +4051,7 @@ namespace __format
       } _M_pc;
 
       constexpr explicit
-      _Scanner(basic_string_view<_CharT> __str, size_t __nargs = -1)
+      _Scanner(basic_string_view<_CharT> __str, size_t __nargs = (size_t)-1)
       : _M_pc(__str, __nargs)
       { }
 
-- 
2.49.0

Reply via email to