[PATCH] test-assert-c++-variadic.cc: Disable assert_works for GCC 14.2 or later

Tomasz Kaminski tkaminsk@redhat.com
Tue Mar 3 14:06:39 GMT 2026


On Tue, Mar 3, 2026 at 2:41 PM Tomasz Kamiński <tkaminsk@redhat.com> wrote:

> PR118629 [1] resolved issue with usage of __PRETTY_FUNCTION__
> (to which assert expands) inside unevaluated context for GCC 14.3.
>
> 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
> ---
>
For reference, this effectively disables the assert_works for GCC 14.1 and
14.2 only,
as -std=c++26 flag support was introduced in GCC 14.1.

> Omitting DCO signed-off-by footer on purpose, the change does not seem
> copyrightable.
>
>  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..3a5c431ae8 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) || __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) || __clang__
> +
>  #define NDEBUG
>  #include <assert.h>
>
> --
> 2.53.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260303/29d177e6/attachment.htm>


More information about the Libc-alpha mailing list