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

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 28 07:38:12 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Gergely Futo (futog)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/219490.diff


1 Files Affected:

- (modified) libcxx/include/valarray (+1-1) 


``````````diff
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;
 }
 

``````````

</details>


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


More information about the libcxx-commits mailing list