From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B14E1388CC22; Wed, 29 Jul 2020 18:25:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B14E1388CC22 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596047128; bh=Ayb4DVx087kmDS/OO1b5iQMTiKzLAOaIITl/HTiBWBY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tNB7u4cTnomdsoqe1sgMmy22UbVndJlXsieKRwn2+lR7Eri2xovh5zDoAdI4+pS4l 9XQFL04ihQ8l8yFXkq9enlq6x0Tk2pNnyxgJa0xP0KnBDYZK1cIPKVEew2GE5RmZZb MIQfe8i5q1YZOLw6LmrjAX4f1W4LBDKwKZyTpE90= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/91427] Implement P1825R0, Merged wording for P0527R1 and P1155R3 Date: Wed, 29 Jul 2020 18:25:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jason 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2020 18:25:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D91427 --- Comment #2 from CVS Commits --- The master branch has been updated by Jason Merrill : https://gcc.gnu.org/g:1722e2013f05f1f1f99379dbaa0c0df356da731f commit r11-2412-g1722e2013f05f1f1f99379dbaa0c0df356da731f Author: Jason Merrill Date: Tue Jul 21 00:19:49 2020 -0400 c++: Implement C++20 implicit move changes. [PR91427] P1825R0 extends the C++11 implicit move on return by removing the constraints on the called constructor: previously, it needed to take an rvalue reference to the type of the returned variable. The paper also allows move on throw of parameters and implicit move of rvalue referenc= es. Discussion on the CWG reflector about how to avoid breaking the PR91212 test in the new model settled on the model of doing only a single overload resolution, with the variable treated as an xvalue that can bind to non-const lvalue references. So this patch implements that approach. = The implementation does not use the existing LOOKUP_PREFER_RVALUE flag, but instead sets a flag on the representation of the static_cast turning the variable into an xvalue. For the time being I'm limiting the new semantics to C++20 mode; since = it was moved as a DR, we will probably want to apply the change to other standard modes as well once we have a better sense of the impact on existing code, probably in GCC 12. gcc/cp/ChangeLog: PR c++/91427 * cp-tree.h (IMPLICIT_RVALUE_P): New. (enum cp_lvalue_kind_flags): Add clk_implicit_rval. (implicit_rvalue_p, set_implicit_rvalue_p): New. * call.c (reference_binding): Check clk_implicit_rval. (build_over_call): Adjust C++20 implicit move. * coroutines.cc (finish_co_return_stmt): Simplify implicit move. * except.c (build_throw): Adjust C++20 implicit move. * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate IMPLICIT_RVALUE_P. * tree.c (lvalue_kind): Set clk_implicit_rval. * typeck.c (treat_lvalue_as_rvalue_p): Overhaul. (maybe_warn_pessimizing_move): Adjust. (check_return_expr): Adjust C++20 implicit move. gcc/testsuite/ChangeLog: PR c++/91427 * g++.dg/coroutines/co-return-syntax-10-movable.C: Extend. * g++.dg/cpp0x/Wredundant-move1.C: Adjust for C++20. * g++.dg/cpp0x/Wredundant-move7.C: Adjust for C++20. * g++.dg/cpp0x/Wredundant-move9.C: Adjust for C++20. * g++.dg/cpp0x/elision_neg.C: Adjust for C++20. * g++.dg/cpp0x/move-return2.C: Adjust for C++20. * g++.dg/cpp0x/ref-qual20.C: Adjust for C++20. * g++.dg/cpp2a/implicit-move1.C: New test. * g++.dg/cpp2a/implicit-move2.C: New test. * g++.dg/cpp2a/implicit-move3.C: New test.=