gcc/libstdc++-v3/include
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
..
backward P0935R0 Eradicating unnecessarily explicit default constructors 2018-06-14 15:12:24 +01:00
bits PR libstdc++/87641 correctly initialize accumulator in valarray::sum() 2018-10-18 16:38:50 +01:00
c Update copyright years. 2018-01-03 11:03:58 +01:00
c_compatibility Update copyright years. 2018-01-03 11:03:58 +01:00
c_global Remove <chrono> dependency on _GLIBCXX_USE_C99_STDINT_TR1 2018-07-26 15:01:55 +01:00
c_std Update copyright years. 2018-01-03 11:03:58 +01:00
debug revert: [multiple changes] 2018-10-18 05:36:02 +00:00
decimal Update copyright years. 2018-01-03 11:03:58 +01:00
experimental Fix versioned namespace macros for Networking TS 2018-10-16 17:12:51 +01:00
ext Make ext allocators support heterogeneous equality comparison 2018-10-11 12:32:29 +01:00
parallel Update copyright years. 2018-01-03 11:03:58 +01:00
precompiled Add initial version of C++17 <memory_resource> header 2018-07-24 22:09:55 +01:00
profile Update copyright years. 2018-01-03 11:03:58 +01:00
std re PR libstdc++/87619 (sizeof(std::variant) can be reduced if its variant_size is UCHAR_MAX) 2018-10-17 22:08:51 +03:00
tr1 Fix warning with -Wsign-compare -Wsystem-headers 2018-08-16 18:16:33 +01:00
tr2 Update copyright years. 2018-01-03 11:03:58 +01:00
Makefile.am Initial commit of Networking TS implementation 2018-10-12 11:50:15 +01:00
Makefile.in Initial commit of Networking TS implementation 2018-10-12 11:50:15 +01:00