diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-11-01 11:06:51 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-11-01 13:26:29 +0000 |
commit | 91bac9fed5d082f0b180834110ebc0f46f97599a (patch) | |
tree | fee69d3a9ffe1e3a6252ea0e4e09132e8b068883 /libcpp/internal.h | |
parent | bc5baac5c37d8da1931043c4bbeffa3ab93a8e91 (diff) | |
download | gcc-91bac9fed5d082f0b180834110ebc0f46f97599a.zip gcc-91bac9fed5d082f0b180834110ebc0f46f97599a.tar.gz gcc-91bac9fed5d082f0b180834110ebc0f46f97599a.tar.bz2 |
libstdc++: Fix range access for empty std::valarray [PR103022]
The std::begin and std::end overloads for std::valarray are defined in
terms of std::addressof(v[0]) which is undefined for an empty valarray.
libstdc++-v3/ChangeLog:
PR libstdc++/103022
* include/std/valarray (begin, end): Do not dereference an empty
valarray. Add noexcept and [[nodiscard]].
* testsuite/26_numerics/valarray/range_access.cc: Check empty
valarray. Check iterator properties. Run as well as compiling.
* testsuite/26_numerics/valarray/range_access2.cc: Likewise.
* testsuite/26_numerics/valarray/103022.cc: New test.
Diffstat (limited to 'libcpp/internal.h')
0 files changed, 0 insertions, 0 deletions