From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E17123858CDA; Wed, 29 Mar 2023 21:26:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E17123858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680125160; bh=qMzRJIdQ9kdP8JrIERk2pAqzWTlxTzxB0vfKUT2uhfM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZGpdXYKcWvtdXNqV97FNJOcQ30jnX0MOnfl1uHd8XdsRcyxbN8mkFXCpyw7obV12A B5ai9vrNVXFqhmTg+VO2nZx2K6WAege+XvHFhkGpmohChRMUUBhu1T2twVUdW+lxaC iqydN8hu3QYiXH2egfKh4D15jyZZizld/nY9oLBQ= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109242] C++2b std::optional::transform omits required std::remove_cv_t from return optional type Date: Wed, 29 Mar 2023 21:26:00 +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.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords assigned_to bug_status 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=3D109242 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu= .org Status|NEW |ASSIGNED --- Comment #3 from Jonathan Wakely --- (In reply to Peter Kasting from comment #2) > struct S { > int& i() const; > }; >=20 > void foo() { > std::optional().transform(&S::i); The U type is a reference here, which isn't allowed. This shows the bug: struct A { }; const A f(int); std::optional o; A&& p =3D *o.transform(f);=