]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Add missing exception specifications in tests
authorJonathan Wakely <jwakely@redhat.com>
Tue, 10 Sep 2024 15:59:29 +0000 (16:59 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 10 Sep 2024 16:33:32 +0000 (17:33 +0100)
commit4e1e50458b2004d0f08ac8c64f89b85fc1a87057
tree8c09932e3d445aa80f765b89b2dadcff1679d8eb
parent2801a49d1144bce5568b527d1972952ad3420f66
libstdc++: Add missing exception specifications in tests

Since r15-3532-g7cebc6384a0ad6 18_support/new_nothrow.cc fails in C++98 mode because G++
diagnoses missing exception specifications for the user-defined
(de)allocation functions. Add throw(std::bad_alloc) and throw() for
C++98 mode.

Similarly, 26_numerics/headers/numeric/synopsis.cc fails in C++20 mode
because the declarations of gcd and lcm are not noexcept.

libstdc++-v3/ChangeLog:

* testsuite/18_support/new_nothrow.cc (THROW_BAD_ALLOC): Define
macro to add exception specifications for C++98 mode.
(NOEXCEPT): Expand to throw() for C++98 mode.
* testsuite/26_numerics/headers/numeric/synopsis.cc (gcd, lcm):
Add noexcept.
libstdc++-v3/testsuite/18_support/new_nothrow.cc
libstdc++-v3/testsuite/26_numerics/headers/numeric/synopsis.cc