mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 20:36:05 +00:00

The valarray<>::operator[](...) const functions return proxy objects. The valarray<>::operator[](...) functions return valarray objects. However the standard allows functions returning valarray objects to return custom proxy objects instead. Libc++ returns __val_expr proxies. Functions taking a valarray object must work with the custom proxies too. Therefore several operations have a custom proxy overload instead of valarray overloads. Libc++ doesn't specify a valarray overload. This is an issue with the standard proxy types; these can implicitly be converted to a valarray. The solution is to allow the standard proxies to behave as-if they are custom proxies. This patch fixes the valarray compound assignments. Other operations, like the binary non-member functions are not fixed. These will be done in a followup patch. Fixes: https://github.com/llvm/llvm-project/issues/21320