On Thu, 6 Mar 2025 at 20:13, Jonathan Wakely wrote:
>
> The r15-2326-gea435261ad58ea change missed a static_assert for
> is_move_constructible_v in expected<cv void, E>::value()&&. When
> exceptions are enabled, the program is ill-formed if the error type is
> not move constructible, because we can't construct the
> std::bad_expected_access. But when using -fno-exceptions, we never
> construct an exception, so don't need to copy/move the error value. So
> that the same code compiles with/without exceptions enabled, we should
> enforce the requirement explicitly.
>
> Add the static_assert, and a test that verifies the Mandates:
> conditions added by LWG 3843 and 3490 are enforced even with
> -fno-exceptions.
>
> libstdc++-v3/ChangeLog:
>
>         * include/std/expected (expected<cv void,E>::value()&&):
>         Add missing static_assert for LWG 3940.
>         * testsuite/20_util/expected/lwg3843.cc: New test.
> ---
>
> Tested x86_64-linux.

Also available for review at https://forge.sourceware.org/gcc/gcc-TEST/pulls/37

Reply via email to