summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/30_threads
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-10-18 16:38:50 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-10-18 16:38:50 +0100
commitfab2c75b73c11d5c6d652a20bfa34e1733f1407f (patch)
treeceb55f655207d0eb8205ce2feba2e21d59e1cd64 /libstdc++-v3/testsuite/30_threads
parentb71679934e64bdad94409ace50ee79471cad6f20 (diff)
downloadgcc-fab2c75b73c11d5c6d652a20bfa34e1733f1407f.tar.gz
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
Diffstat (limited to 'libstdc++-v3/testsuite/30_threads')
0 files changed, 0 insertions, 0 deletions