diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-09-27 15:51:56 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2024-09-27 21:41:31 +0100 |
commit | 7040c207baa6b5d5f6065a47dd3559f3d3974a1b (patch) | |
tree | 72a6b1f13d8b65abcb9b154d984962f78ee4375a | |
parent | 96e0370f4daef29b918aafcff68c7f5e4ef397fd (diff) | |
download | gcc-7040c207baa6b5d5f6065a47dd3559f3d3974a1b.zip gcc-7040c207baa6b5d5f6065a47dd3559f3d3974a1b.tar.gz gcc-7040c207baa6b5d5f6065a47dd3559f3d3974a1b.tar.bz2 |
libstdc++: Fix -Wsign-compare warning in std::string::resize_for_overwrite
libstdc++-v3/ChangeLog:
* include/bits/basic_string.tcc (resize_for_overwrite): Fix
-Wsign-compare warning.
* include/bits/cow_string.h (resize_for_overwrite): Likewise.
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.tcc | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/cow_string.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc index 2c17d25..caeddaf 100644 --- a/libstdc++-v3/include/bits/basic_string.tcc +++ b/libstdc++-v3/include/bits/basic_string.tcc @@ -611,7 +611,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static_assert(__gnu_cxx::__is_integer_nonstrict<decltype(__r)>::__value, "resize_and_overwrite operation must return an integer"); #endif - _GLIBCXX_DEBUG_ASSERT(__r >= 0 && __r <= __n); + _GLIBCXX_DEBUG_ASSERT(__r >= 0 && size_type(__r) <= __n); __term._M_r = size_type(__r); if (__term._M_r > __n) __builtin_unreachable(); diff --git a/libstdc++-v3/include/bits/cow_string.h b/libstdc++-v3/include/bits/cow_string.h index b78aa74..087ddf8 100644 --- a/libstdc++-v3/include/bits/cow_string.h +++ b/libstdc++-v3/include/bits/cow_string.h @@ -3800,7 +3800,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static_assert(__gnu_cxx::__is_integer_nonstrict<decltype(__r)>::__value, "resize_and_overwrite operation must return an integer"); #endif - _GLIBCXX_DEBUG_ASSERT(__r >= 0 && __r <= __n); + _GLIBCXX_DEBUG_ASSERT(__r >= 0 && size_type(__r) <= __n); __term._M_r = size_type(__r); if (__term._M_r > __n) __builtin_unreachable(); |