From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4733C385770D; Mon, 22 May 2023 03:12:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4733C385770D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684725139; bh=uem6mRn0sO2Nr8uPD+Sx4/38qa0aMoRm7pFWyiVHO7w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mBTFn3Y2BDmn0z7ejsP6ZnvQANNsayS25Fy5d77a8PPROYKrRrHw2bBeVdULsst7O r1R/TdHuvddZD3gQBlp4OCR07K+1DMtC0oPg+Uic5lHoT5d1w1CQu4y8lb4Z4U4f0c GsmkyWrpQTd4DmX+ns6qARe2Z8yJWRf4nrAiIZH0= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107864] [10/11 Regression] ICE (seg fault) in check_return_expr or instantiate_body with concepts and specialized version Date: Mon, 22 May 2023 03:12:17 +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: 13.0 X-Bugzilla-Keywords: 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: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 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=3D107864 --- Comment #11 from CVS Commits --- The releases/gcc-11 branch has been updated by Patrick Palka : https://gcc.gnu.org/g:17e3edd6a25e47eed56678f25f6f8ab29b0ac5fc commit r11-10803-g17e3edd6a25e47eed56678f25f6f8ab29b0ac5fc Author: Patrick Palka Date: Tue Nov 29 09:55:21 2022 -0500 c++: explicit specialization and trailing requirements [PR107864] Here we're crashing when using the explicit specialization of the function template g with trailing requirements ultimately because earlier decls_match (called indirectly from register_specialization) for for the explicit specialization returned false since the template has trailing requirements whereas the specialization doesn't. In r12-2230-gddd25bd1a7c8f4, we fixed a similar issue concerning templa= te requirements instead of trailing requirements. We could extend that fix to ignore trailing requirement mismatches for explicit specializations as well, but it seems cleaner to just propagate constraints from the specialized template to the specialization when declaring an explicit specialization so that decls_match will naturally return true in this case. And it looks like determine_specialization already does this, albeit inconsistently (only when specializing a non-template member function of a class template as in cpp2a/concepts-explicit-spec4.C). So this patch makes determine_specialization consistently propagate constraints from the specialized template to the specialization, which in turn lets us get rid of the function_requirements_equivalent_p speci= al case added by r12-2230. PR c++/107864 gcc/cp/ChangeLog: * decl.c (function_requirements_equivalent_p): Don't check DECL_TEMPLATE_SPECIALIZATION. * pt.c (determine_specialization): Propagate constraints when specializing a function template too. Simplify by using add_outermost_template_args. gcc/testsuite/ChangeLog: * g++.dg/concepts/explicit-spec1a.C: New test. (cherry picked from commit 36cabc257dfb7dd4f7625896891f6c5b195a0241)=