[gcc r16-2398] libstdc++: Fix obvious mistake in inplace_vector::assign_range [PR119137]
Tomasz Kaminski
tkaminsk@gcc.gnu.org
Tue Jul 22 07:36:43 GMT 2025
https://gcc.gnu.org/g:ae00818713756fd45ee379a8a30ae907959433fe
commit r16-2398-gae00818713756fd45ee379a8a30ae907959433fe
Author: Tomasz Kamiński <tkaminsk@redhat.com>
Date: Tue Jul 22 09:32:47 2025 +0200
libstdc++: Fix obvious mistake in inplace_vector::assign_range [PR119137]
In case of input iterators, the loop that assigns to existing elements
should run up to number of elements in vector (_M_size) not capacity (_Nm).
PR libstdc++/119137
libstdc++-v3/ChangeLog:
* include/std/inplace_vector (inplace_vector::assign_range):
Replace _Nm with _M_size in the assigment loop.
Diff:
---
libstdc++-v3/include/std/inplace_vector | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libstdc++-v3/include/std/inplace_vector b/libstdc++-v3/include/std/inplace_vector
index e0943f52ab83..290cf6eb0e92 100644
--- a/libstdc++-v3/include/std/inplace_vector
+++ b/libstdc++-v3/include/std/inplace_vector
@@ -269,7 +269,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
auto __in = ranges::begin(__rg);
auto __end = ranges::end(__rg);
size_type __n = 0;
- for (; __n < _Nm && __in != __end; ++__in)
+ for (; __n < _M_size && __in != __end; ++__in)
_M_elems[__n++] = *__in;
if (__in == __end)
More information about the Libstdc++-cvs
mailing list