[PATCH] assert: Support assert as variadic macro for C++26 [PR27276]

Florian Weimer fweimer@redhat.com
Thu Feb 5 15:54:55 GMT 2026


* Tomasz Kaminski:

> I will add following in do_test in test-assert-c++.cc, as there seem to be no
> check for lack of double evaluation:
>
> diff --git a/assert/tst-assert-c++.cc b/assert/tst-assert-c++.cc
> index 7fb8bbfe26..534a191fbd 100644
> --- a/assert/tst-assert-c++.cc
> +++ b/assert/tst-assert-c++.cc
> @@ -90,6 +90,13 @@ do_test ()
>      // assert(E::e1);
>    }
>  
> +  {
> +    int i = 0;
> +    assert(++i);
> +    if (i != 1)
> +      return 1;
> +  }

Please hide the side effect in a function call, so that the test doesn't
fail to build once GCC starts warning about side effects in assert.

Thanks,
Florian



More information about the Libc-alpha mailing list