public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-9743] c++: alias_ctad_tweaks and constrained dguide [PR95486] Date: Wed, 21 Apr 2021 14:27:33 +0000 (GMT) [thread overview] Message-ID: <20210421142733.089103860C32@sourceware.org> (raw) https://gcc.gnu.org/g:4806f9157a26cfd66c083bcc01596ff33009c0d6 commit r10-9743-g4806f9157a26cfd66c083bcc01596ff33009c0d6 Author: Patrick Palka <ppalka@redhat.com> Date: Wed Jul 29 22:06:41 2020 -0400 c++: alias_ctad_tweaks and constrained dguide [PR95486] In the below testcase, we're ICEing from alias_ctad_tweaks ultimately because the implied deduction guide for X's user-defined constructor already has constraints associated with it. We then carry over these constraints to 'fprime', the overlying deduction guide for the alias template Y, via tsubst_decl from alias_ctad_tweaks. Later in alias_ctad_tweaks we call get_constraints followed by set_constraints without doing remove_constraints in between, which triggers the !found assert in set_constraints. This patch fixes this issue by adding an intervening call to remove_constraints. gcc/cp/ChangeLog: PR c++/95486 * pt.c (alias_ctad_tweaks): Call remove_constraints before calling set_constraints. gcc/testsuite/ChangeLog: PR c++/95486 * g++.dg/cpp2a/class-deduction-alias3.C: New test. (cherry picked from commit 71141b1bd537cc516e485c834c2d36abba3f4544) Diff: --- gcc/cp/pt.c | 5 ++++- gcc/testsuite/g++.dg/cpp2a/class-deduction-alias3.C | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 76c7e428ecd..ae396e056c5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -28823,7 +28823,10 @@ alias_ctad_tweaks (tree tmpl, tree uguides) } if (ci) - set_constraints (fprime, ci); + { + remove_constraints (fprime); + set_constraints (fprime, ci); + } } else { diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias3.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias3.C new file mode 100644 index 00000000000..318d4c942ce --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias3.C @@ -0,0 +1,11 @@ +// PR c++/95486 +// { dg-do compile { target c++20 } } + +template<class T, class U> +struct X { X(U) requires __is_same(U, int) {} }; + +template<class U> +using Y = X<void, U>; + +Y y{1}; +Y z{'a'}; // { dg-error "failed|no match" }
reply other threads:[~2021-04-21 14:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210421142733.089103860C32@sourceware.org \ --to=ppalka@gcc.gnu.org \ --cc=gcc-cvs@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).