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 r12-2990] c++: ignore explicit dguides during NTTP CTAD [PR101883] Date: Wed, 18 Aug 2021 12:39:21 +0000 (GMT) [thread overview] Message-ID: <20210818123921.1F74D385501A@sourceware.org> (raw) https://gcc.gnu.org/g:a6b3db3e8625a3cba1240f0b5e1a29bd6c68b8ca commit r12-2990-ga6b3db3e8625a3cba1240f0b5e1a29bd6c68b8ca Author: Patrick Palka <ppalka@redhat.com> Date: Wed Aug 18 08:37:42 2021 -0400 c++: ignore explicit dguides during NTTP CTAD [PR101883] Since (template) argument passing is a copy-initialization context, we mustn't consider explicit deduction guides when deducing a CTAD placeholder type of an NTTP. PR c++/101883 gcc/cp/ChangeLog: * pt.c (convert_template_argument): Pass LOOKUP_IMPLICIT to do_auto_deduction. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/nontype-class49.C: New test. Diff: --- gcc/cp/pt.c | 3 ++- gcc/testsuite/g++.dg/cpp2a/nontype-class49.C | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 484723b00db..0c1496693e2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8486,7 +8486,8 @@ convert_template_argument (tree parm, can happen in the context of -fnew-ttp-matching. */; else if (tree a = type_uses_auto (t)) { - t = do_auto_deduction (t, arg, a, complain, adc_unify, args); + t = do_auto_deduction (t, arg, a, complain, adc_unify, args, + LOOKUP_IMPLICIT); if (t == error_mark_node) return error_mark_node; } diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class49.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class49.C new file mode 100644 index 00000000000..c83e4075ed0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class49.C @@ -0,0 +1,8 @@ +// PR c++/101883 +// { dg-do compile { target c++20 } } + +template<class T> struct C { constexpr C(int) { } }; +explicit C(int) -> C<int>; + +template<C c> struct X { }; +X<1> x; // { dg-error "deduction|no match" }
reply other threads:[~2021-08-18 12:39 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=20210818123921.1F74D385501A@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).