From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6902B3858D3C; Wed, 24 May 2023 19:34:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6902B3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684956851; bh=2sGIVQAXupYGjxXgxwmWDYyspiHCcc/FA9aGv2NgqIM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=emuMwuX/3ZpJlS3yrSg40NMLvmJ7ujKL4HYttlV6QsxrcYwJ5FOxQ/ClJi/kR9C+S qx6NGuwAHPh8ya378kht8yHtqsmNXtKyBLzbzgE3s7jJz29uJk6igSPSg60/GPj3kN yecNWT8IhH6fCsX2hUXbkqOwsyRHRajRpNSoMxiI= From: "aemseemann at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109947] std::expected monadic operations do not support move-only error types yet Date: Wed, 24 May 2023 19:34:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: aemseemann at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109947 --- Comment #3 from Martin Seemann --- Thanks for pointing me to the LWG issue. It makes sense that the error type must be copyable for the `value()` overloads due to potentially throwing a `bad_expected_access` with the embedded error embedded. However, the monadic operations will never throw this exception. Consequently, the standard draft for the monadic operations (https://eel.is/c++draft/expected.object.monadic) does not contain any "Throws:" clause nor is copyability of the error type included in the "Constraints:" clause. So it comes down to how to interpret the "Effects:" clause: Does "Equivalen= t to " mean that all restrictions of `value()` apply transitively or is it merely an implementation hint? (Strangely enough, in the "Effects:" clause of `value_or()&&` the expression `std::move(**this)` is used instead of `std::move(value())`. Maybe this is= an oversight/inconsistency of the standard.)=