From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A21A53854810; Tue, 7 Mar 2023 02:18:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A21A53854810 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678155506; bh=ZjE8IbSbytKOp/UcKU/XsTrR/insYUA4K9cgOYgmm5M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jqh0Pd7hs6uWeEQ2+uVnf0pMiIzWFa3qa72Cl3QYOCTu8KMzpG0UsRyM420m8XBMJ N4xRPkOhzlXGWJbLI1C7Lx9YMiBxnpRKYYl2QCoXUzycc9IURzv2UlDbaPhf4vuSFs AweKF4XAAtYFXg+cEFnDI4Ww6btGXgMeztzfSiio= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107853] [10/11/12 Regression] variadic template with a variadic template friend with a requires of fold expression Date: Tue, 07 Mar 2023 02:18:25 +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-checking, ice-on-valid-code, rejects-valid 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.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=3D107853 --- Comment #7 from CVS Commits --- The releases/gcc-12 branch has been updated by Patrick Palka : https://gcc.gnu.org/g:cb39089c5a0da1e9b16ad27db557a2c3f930e668 commit r12-9229-gcb39089c5a0da1e9b16ad27db557a2c3f930e668 Author: Patrick Palka Date: Fri Dec 23 09:18:37 2022 -0500 c++: template friend with variadic constraints [PR107853] When instantiating a constrained hidden template friend, we substitute into its template-head requirements in tsubst_friend_function. For this substitution we use the template's full argument vector whose outer levels correspond to the instantiated class's arguments and innermost level corresponds to the template's own level-lowered generic arguments. But for A::f here, for which the relevant argument vector is {{int}, {Us...}}, the substitution into (C && ...) triggers the assert in use_pack_expansion_extra_args_p since one argument is a pack expansion and the other isn't. And for A::f, for which the relevant argument vector is {{int, int}, {Us...}}, the use_pack_expansion_extra_args_p assert would also trigger but we first get a bogus "mismatched argument pack lengths" error from tsubst_pack_expansion. Sidestepping the question of whether tsubst_pack_expansion should be able to handle such substitutions, it seems we can work around this by using only the instantiated class's arguments and not also the template friend's own generic arguments, which is consistent with how we normally substitute into the signature of a member template. PR c++/107853 gcc/cp/ChangeLog: * constraint.cc (maybe_substitute_reqs_for): Substitute into the template-head requirements of a template friend using only its outer arguments via outer_template_args. * cp-tree.h (outer_template_args): Declare. * pt.cc (outer_template_args): Define, factored out and generalized from ... (ctor_deduction_guides_for): ... here. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-friend12.C: New test. * g++.dg/cpp2a/concepts-friend13.C: New test. (cherry picked from commit bd1fc4a219d8c0fad0ec41002e895b49e384c1c2)=