gcc/libstdc++-v3/testsuite/26_numerics/valarray
Jonathan Wakely fab2c75b73 PR libstdc++/87641 correctly initialize accumulator in valarray::sum()
Use the value of the first element as the initial value of the
__valarray_sum accumulator. Value-initialization might not create the
additive identity for the value type.

Make a similar change to __valarray_product even though it's only ever
used internally with a value_type of size_t.

	PR libstdc++/87641
	* include/bits/valarray_array.h (__valarray_sum): Use first element
	to initialize accumulator instead of value-initializing it.
	(__valarray_product<_Tp>): Move to ...
	* src/c++98/valarray.cc (__valarray_product<_Tp>): Here. Use first
	element to initialize accumulator.
	(__valarray_product(const valarray<size_t>&)): Remove const_cast made
	unnecessary by LWG 389.
	* testsuite/26_numerics/valarray/87641.cc: New test.

From-SVN: r265270
2018-10-18 16:38:50 +01:00
..
requirements Update copyright years. 2018-01-03 11:03:58 +01:00
27867.cc Update copyright years. 2018-01-03 11:03:58 +01:00
28277.cc Update copyright years. 2018-01-03 11:03:58 +01:00
30416.cc Update copyright years. 2018-01-03 11:03:58 +01:00
33084.cc Update copyright years. 2018-01-03 11:03:58 +01:00
40691.cc Update copyright years. 2018-01-03 11:03:58 +01:00
69116.cc Update copyright years. 2018-01-03 11:03:58 +01:00
83860.cc PR libstdc++/83860 avoid dangling references in valarray closure types 2018-05-02 17:41:46 +01:00
87641.cc PR libstdc++/87641 correctly initialize accumulator in valarray::sum() 2018-10-18 16:38:50 +01:00
algo.cc Update copyright years. 2018-01-03 11:03:58 +01:00
binary_closure.cc
const_bracket.cc Update copyright years. 2018-01-03 11:03:58 +01:00
deduction.cc Update copyright years. 2018-01-03 11:03:58 +01:00
dr543.cc Update copyright years. 2018-01-03 11:03:58 +01:00
dr630-1.cc Update copyright years. 2018-01-03 11:03:58 +01:00
dr630-2.cc Update copyright years. 2018-01-03 11:03:58 +01:00
dr630-3.C Update copyright years. 2018-01-03 11:03:58 +01:00
init-list.cc Update copyright years. 2018-01-03 11:03:58 +01:00
moveable.cc Update copyright years. 2018-01-03 11:03:58 +01:00
name_lookup.cc Update copyright years. 2018-01-03 11:03:58 +01:00
noexcept_move_construct.cc Update copyright years. 2018-01-03 11:03:58 +01:00
operators.cc LWG 3074 make scalar types non-deduced in valarray non-member functions 2018-06-14 20:36:54 +01:00
range_access.cc Update copyright years. 2018-01-03 11:03:58 +01:00
range_access2.cc Update copyright years. 2018-01-03 11:03:58 +01:00
subset_assignment.cc Update copyright years. 2018-01-03 11:03:58 +01:00
swap.cc Update copyright years. 2018-01-03 11:03:58 +01:00
transcend.cc LWG 3074 make scalar types non-deduced in valarray non-member functions 2018-06-14 20:36:54 +01:00