]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Add noexcept to std::begin etc as per LWG 2280 and 3537
authorJonathan Wakely <jwakely@redhat.com>
Mon, 22 Mar 2021 15:15:12 +0000 (15:15 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 29 Mar 2021 19:58:49 +0000 (20:58 +0100)
commite7b2f969346435c5b460a4021b1334c0a4c11df2
tree2aea3d9c74063482f23c378fb25b5d90db3bd703
parentad9ae82ed1c33e1803f33bb367b0b4c9ee2e3e63
libstdc++: Add noexcept to std::begin etc as per LWG 2280 and 3537

This implements the proposed changes for LWG 3537 (which we're allowed
to do as an extension whatever the outcome of the issue). I noticed we
didn't implement LWG 2280 completely, as the std::begin and std::end
overloads for arrays were not noexcept.

libstdc++-v3/ChangeLog:

* include/bits/range_access.h (begin(T (&)[N]), end(T (&)[N])):
Add missing 'noexcept' as per LWG 2280.
(rbegin(T (&)[N]), rend(T (&)[N]), rbegin(initializer_list<T>))
(rend(initializer_list<T>)): Add 'noexcept' as per LWG 3537.
* testsuite/24_iterators/range_access/range_access.cc: Check for
expected noexcept specifiers. Check result types of generic
std::begin and std::end overloads.
* testsuite/24_iterators/range_access/range_access_cpp14.cc:
Check for expected noexcept specifiers.
* testsuite/24_iterators/range_access/range_access_cpp17.cc:
Likewise.

(cherry picked from commit 00b46c00c8d9003c61e8f817668ad3380e16fedb)
libstdc++-v3/include/bits/range_access.h
libstdc++-v3/testsuite/24_iterators/range_access/range_access.cc
libstdc++-v3/testsuite/24_iterators/range_access/range_access_cpp14.cc
libstdc++-v3/testsuite/24_iterators/range_access/range_access_cpp17.cc
This page took 0.061855 seconds and 6 git commands to generate.