[PATCH v2] test-assert-c++-variadic.cc: Disable assert_works for GCC 14.2 and 14.1

Tomasz Kamiński tkaminsk@redhat.com
Thu Mar 5 06:52:41 GMT 2026


PR118629 [1] resolved issue with usage of __PRETTY_FUNCTION__
(to which assert expands) inside unevaluated context for GCC 14.3.
This affects only versions 14.1 and 14.2, as -std=c++26 option is
supported since 14.1.

clang supports above snippet for all version that supports --std=c++26
flag (since 17.0.1).

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118629
---
v2:
- used defined __clang__ to check for clang compiler
- pin down exact GCC version affected

 assert/test-assert-c++-variadic.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/assert/test-assert-c++-variadic.cc b/assert/test-assert-c++-variadic.cc
index c220611c4f..2d0c29a9a8 100644
--- a/assert/test-assert-c++-variadic.cc
+++ b/assert/test-assert-c++-variadic.cc
@@ -65,6 +65,9 @@ test_enabled ()
   }
 }
 
+// GCC PR118629 fixed the handling of assert inside requires clause
+#if __GNUC_PREREQ (14, 3) || defined __clang__
+
 template <typename Ts>
 constexpr bool
 assert_works ()
@@ -82,6 +85,8 @@ static_assert ( assert_works <OE> ());
 static_assert ( assert_works <TE> ());
 static_assert (!assert_works <SE> ());
 
+#endif // __GNUC_PREREQ (14, 3) || defined __clang__
+
 #define NDEBUG
 #include <assert.h>
 
-- 
2.53.0



More information about the Libc-alpha mailing list