[libc++] Use addressof in assignment operator.
Replace `&__rhs` with `_VSTD::addressof(__rhs)` to guard against ADL hijacking
of `operator&` in `operator=`. Thanks to @CaseyCarter for bringing it to our
attention.
Similar issues with hijacking `operator&` still exist, they will be
addressed separately.
Reviewed By: #libc, Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D110852
NOKEYCHECK=True
GitOrigin-RevId: b8608b87239ca7817d1536376a8ce4b5265747ee
diff --git a/include/valarray b/include/valarray
index 6e25514..9a64839 100644
--- a/include/valarray
+++ b/include/valarray
@@ -3048,7 +3048,7 @@
valarray<_Tp>&
valarray<_Tp>::operator=(const valarray& __v)
{
- if (this != &__v)
+ if (this != _VSTD::addressof(__v))
return __assign_range(__v.__begin_, __v.__end_);
return *this;
}