public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-107853-4-7OWlEGbJJ9@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107853-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107853 --- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:cb39089c5a0da1e9b16ad27db557a2c3f930e668 commit r12-9229-gcb39089c5a0da1e9b16ad27db557a2c3f930e668 Author: Patrick Palka <ppalka@redhat.com> 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<int>::f here, for which the relevant argument vector is {{int}, {Us...}}, the substitution into (C<Ts, Us> && ...) 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<int, int>::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)
next prev parent reply other threads:[~2023-03-07 2:18 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-23 23:39 [Bug c++/107853] New: Cannot create friend function template with variadic pack that depends on variadic pack davidfromonline at gmail dot com 2022-11-24 1:04 ` [Bug c++/107853] Cannot create friend function template with a requires uses the " pinskia at gcc dot gnu.org 2022-11-24 1:09 ` [Bug c++/107853] [10/11/12/13 Regression] variadic template with a variadic template friend with a requires of fold expression pinskia at gcc dot gnu.org 2022-12-21 9:52 ` rguenth at gcc dot gnu.org 2022-12-21 16:09 ` ppalka at gcc dot gnu.org 2022-12-21 16:09 ` ppalka at gcc dot gnu.org 2022-12-21 16:10 ` ppalka at gcc dot gnu.org 2022-12-23 14:18 ` cvs-commit at gcc dot gnu.org 2022-12-23 14:19 ` [Bug c++/107853] [10/11/12 " ppalka at gcc dot gnu.org 2023-03-07 2:18 ` cvs-commit at gcc dot gnu.org [this message] 2023-04-05 20:16 ` mpolacek at gcc dot gnu.org 2023-04-06 13:25 ` [Bug c++/107853] [10/11 " ppalka at gcc dot gnu.org 2023-07-07 10:44 ` [Bug c++/107853] [11 " rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-107853-4-7OWlEGbJJ9@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).