[gcc r17-910] libstdc++: Fix -fno-exceptions support in testsuite_allocator.h
Patrick Palka
ppalka@gcc.gnu.org
Thu May 28 14:41:49 GMT 2026
https://gcc.gnu.org/g:b64700dec403f9b2b605df295e43c73b3185d0f5
commit r17-910-gb64700dec403f9b2b605df295e43c73b3185d0f5
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu May 28 10:41:33 2026 -0400
libstdc++: Fix -fno-exceptions support in testsuite_allocator.h
This fixes the error
.../testsuite_allocator.h:402:13: error: exception handling disabled, use '-fexceptions' to enable
402 | catch(...)
| ^~~~~
seen when running some C++23 library tests with -fno-exceptions.
libstdc++-v3/ChangeLog:
* testsuite/util/testsuite_allocator.h
(uneq_allocator::allocate): Use __try/__catch instead.
(uneq_allocator::allocate_at_least): Likewise.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Diff:
---
libstdc++-v3/testsuite/util/testsuite_allocator.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h
index 27372a97161d..3a9ae0de5853 100644
--- a/libstdc++-v3/testsuite/util/testsuite_allocator.h
+++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h
@@ -369,12 +369,12 @@ namespace __gnu_test
if (std::__is_constant_evaluated())
return p;
- try
+ __try
{
get_map().insert(map_type::value_type(reinterpret_cast<void*>(p),
personality));
}
- catch(...)
+ __catch(...)
{
AllocTraits::deallocate(*this, p, n);
__throw_exception_again;
@@ -394,12 +394,12 @@ namespace __gnu_test
{ return r; }
else
{
- try
+ __try
{
get_map().insert(map_type::value_type(
reinterpret_cast<void*>(r.ptr), personality));
}
- catch(...)
+ __catch(...)
{
AllocTraits::deallocate(*this, r.ptr, r.count);
__throw_exception_again;
More information about the Libstdc++-cvs
mailing list