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

Florian Weimer fweimer@redhat.com
Mon Mar 9 18:37:28 GMT 2026


* Tomasz Kamiński:

> 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>

This is okay technically except for the comment style.  I don't mind,
but we've been historically quite prescriptive about using GNU style, so
/* and */ and “.  */” at the end of the comment.

Thanks,
Florian



More information about the Libc-alpha mailing list