From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 24DF63851ABD; Tue, 7 Mar 2023 02:18:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24DF63851ABD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678155503; bh=G8mTm4wpxoqfy06YlmQ2ErIwxjXJhF2CiXM7bC6Z5Ts=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dr9ohjqMqVzU01GSDeJ/bAUyJgeywjUKbHgUj6qe4oMLDfNTDL58dHVso0klSVOZY xpqYJ5WKiqsdhjAq8T0rgbsFlZv4zf19bor2CMx++QlzfGqUKKzKqcCX8vhaDtMH7k gSS4uC24156QJTjk6pAW8e43VssfeTBSuej+4wc8= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107864] [10/11/12 Regression] ICE (seg fault) in check_return_expr or instantiate_body with concepts and specialized version Date: Tue, 07 Mar 2023 02:18:20 +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 #10 from CVS Commits --- The releases/gcc-12 branch has been updated by Patrick Palka : https://gcc.gnu.org/g:18bd59990196462cde8011458e2518118b1b6681 commit r12-9228-g18bd59990196462cde8011458e2518118b1b6681 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.cc (function_requirements_equivalent_p): Don't check DECL_TEMPLATE_SPECIALIZATION. * pt.cc (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)=