[all-commits] [llvm/llvm-project] 5ca277: [libc++] Fixes valarray proxy type compound assign...

Mark de Wever via All-commits all-commits at lists.llvm.org
Sat Feb 3 08:23:43 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5ca2777c69f8708d583e230c56ac7f5f6376fb40
      https://github.com/llvm/llvm-project/commit/5ca2777c69f8708d583e230c56ac7f5f6376fb40
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2024-02-03 (Sat, 03 Feb 2024)

  Changed paths:
    M libcxx/include/valarray
    A libcxx/test/libcxx/numerics/numarray/class.gslice.array/assert.get.pass.cpp
    A libcxx/test/libcxx/numerics/numarray/class.gslice.array/get.pass.cpp
    A libcxx/test/libcxx/numerics/numarray/class.indirect.array/assert.get.pass.cpp
    A libcxx/test/libcxx/numerics/numarray/class.indirect.array/get.pass.cpp
    A libcxx/test/libcxx/numerics/numarray/class.mask.array/assert.get.pass.cpp
    A libcxx/test/libcxx/numerics/numarray/class.mask.array/get.pass.cpp
    A libcxx/test/libcxx/numerics/numarray/class.slice.array/assert.get.pass.cpp
    A libcxx/test/libcxx/numerics/numarray/class.slice.array/get.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.cassign/and_valarray.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.cassign/divide_valarray.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.cassign/minus_valarray.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.cassign/modulo_valarray.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.cassign/or_valarray.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.cassign/plus_valarray.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_left_valarray.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_right_valarray.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.cassign/times_valarray.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.cassign/xor_valarray.pass.cpp

  Log Message:
  -----------
  [libc++] Fixes valarray proxy type compound assignment operations. (#76528)

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




More information about the All-commits mailing list