From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 400C339F8423; Thu, 5 Nov 2020 21:34:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 400C339F8423 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/78209] Decltype of rvalue reference Date: Thu, 05 Nov 2020 21:34:46 +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: 7.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW 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 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: Thu, 05 Nov 2020 21:34:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D78209 --- Comment #3 from CVS Commits --- The master branch has been updated by Marek Polacek : https://gcc.gnu.org/g:e6fd02cc6d874c523466250a1cb724e0c7af9d75 commit r11-4758-ge6fd02cc6d874c523466250a1cb724e0c7af9d75 Author: Marek Polacek Date: Tue Nov 3 15:10:31 2020 -0500 c++: Fix decltype(auto) deduction with rvalue ref [PR78209] Here's a small deficiency in decltype(auto). [dcl.type.auto.deduct]/5: If the placeholder-type-specifier is of the form decltype(auto), [...] the type deduced for T is determined [...] as though E had been the ope= rand of the decltype. So: int &&i =3D 0; decltype(auto) j =3D i; // should behave like int &&j =3D i; error We deduce j's type in do_auto_deduction via finish_decltype_type which takes an 'id' argument. Currently we compute 'id' as false, because stripped_init is *i (a REFERENCE_REF_P). But it seems to me we should rather set 'id' to true here, by looking through the REFERENCE_REF_P, so that finish_decltype_type DTRT. gcc/cp/ChangeLog: PR c++/78209 * pt.c (do_auto_deduction): If init is REFERENCE_REF_P, use its first operand. gcc/testsuite/ChangeLog: PR c++/78209 * g++.dg/cpp1y/decltype-auto1.C: New test.=