[libcxx-commits] [libcxx] [libc++] Correct mask_array assignment (PR #219490)

Gergely Futo via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 28 07:37:32 PDT 2026


https://github.com/futog created https://github.com/llvm/llvm-project/pull/219490

The index array from `__ma` should be used for indexing, instead of the index array from `this`.

>From fe8897d23d2c5dc9ac01ab1f61306d521716f30f Mon Sep 17 00:00:00 2001
From: Gergely Futo <gergely.futo at hightec-rt.com>
Date: Fri, 28 Aug 2026 16:29:07 +0200
Subject: [PATCH] [libc++] Correct mask_array assignment

The index array from `__ma` should be used for indexing, instead of the
index array from `this`.
---
 libcxx/include/valarray | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/include/valarray b/libcxx/include/valarray
index d0997ebf2caae..0d80b997c1295 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -1614,7 +1614,7 @@ template <class _Tp>
 inline const mask_array<_Tp>& mask_array<_Tp>::operator=(const mask_array& __ma) const {
   size_t __n = __1d_.size();
   for (size_t __i = 0; __i < __n; ++__i)
-    __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
+    __vp_[__1d_[__i]] = __ma.__vp_[__ma.__1d_[__i]];
   return *this;
 }
 



More information about the libcxx-commits mailing list