From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0F03A3865474; Wed, 31 Mar 2021 12:33:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F03A3865474 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98990] [10 Regression] ICE when two overloaded functions return `auto &&` and one accepts an `auto` parameter since r10-6571-ga6ee556c7659877b Date: Wed, 31 Mar 2021 12:33:52 +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: 11.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.3 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, 31 Mar 2021 12:33:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98990 --- Comment #7 from CVS Commits --- The releases/gcc-10 branch has been updated by Patrick Palka : https://gcc.gnu.org/g:c76d503527394839f9192ee27abbc0626b4e40d8 commit r10-9637-gc76d503527394839f9192ee27abbc0626b4e40d8 Author: Patrick Palka Date: Thu Feb 25 19:55:43 2021 -0500 c++: abbreviated function template return type rewriting [PR98990] When an abbreviated function template has a complex placeholder return type such auto& or auto**, the level adjustment performed by splice_late_return_type directly replaces the 'auto' inside the original return type with the level-adjusted 'auto', but that breaks TYPE_CANONICAL caching. Instead, we should rebuild the entire return type using the adjusted 'auto'. This patch makes this happen by tsubsting the original return type with an argument vector that maps the original 'auto' to the adjusted 'auto'. In passing, this patch also reverts the misguided changes to find_type_usage in r10-6571 that made find_type_usage return a tree* instead of a tree so as to discourage this kind of in-place type modification. It occurred to me that the constraint also needs to be rebuilt so that it refers to the adjusted 'auto', but this oversight doesn't seem to cause any issues at the moment due to how do_auto_deduction "manually" substitutes the 'auto' inside the constraint before performing satisfaction. So this'll be fixed later as part of a rework of placeholder type constraint checking. gcc/cp/ChangeLog: PR c++/98990 * pt.c (splice_late_return_type): Rebuild the entire return type if we have to adjust the level of an auto within. (type_uses_auto): Adjust call to find_type_usage. * type-utils.h (find_type_usage): Revert r10-6571 change that made this function return a pointer to the auto node. gcc/testsuite/ChangeLog: PR c++/98990 * g++.dg/concepts/abbrev8.C: New test. (cherry picked from commit 6bd409cfc83683a9be5c6b3b8f9a3ec8959f9356)=