public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-8669] c++: alias CTAD and template template parm [PR114377] Date: Wed, 1 May 2024 20:31:53 +0000 (GMT) [thread overview] Message-ID: <20240501203153.D5FCE384AB48@sourceware.org> (raw) https://gcc.gnu.org/g:60e1e13f458f1fcfb05a30ace57fa682461e2732 commit r13-8669-g60e1e13f458f1fcfb05a30ace57fa682461e2732 Author: centurion <centurion009@proton.me> Date: Wed Mar 27 18:36:37 2024 +0000 c++: alias CTAD and template template parm [PR114377] To match all the other places that pull a _TEMPLATE_PARM out of a _DECL (get_template_parm_index, etc.). This change is too small to be legally significant for copyright. PR c++/114377 gcc/cp/ChangeLog: * pt.cc (find_template_parameter_info::found): Use TREE_TYPE for TEMPLATE_DECL instead of DECL_INITIAL. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/class-deduction-alias19.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com> (cherry picked from commit 801e82acd6b4f0cf863529875947e394899ea7b9) Diff: --- gcc/cp/pt.cc | 3 ++- gcc/testsuite/g++.dg/cpp2a/class-deduction-alias19.C | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index a768d11c82f..fa660fcf49e 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -10917,7 +10917,8 @@ find_template_parameter_info::found (tree parm) { if (TREE_CODE (parm) == TREE_LIST) parm = TREE_VALUE (parm); - if (TREE_CODE (parm) == TYPE_DECL) + if (TREE_CODE (parm) == TYPE_DECL + || TREE_CODE (parm) == TEMPLATE_DECL) parm = TREE_TYPE (parm); else parm = DECL_INITIAL (parm); diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias19.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias19.C new file mode 100644 index 00000000000..1ea79bd7691 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias19.C @@ -0,0 +1,15 @@ +// PR c++/114377 +// { dg-do compile { target c++20 } } + +template <template <typename> typename Iterator> +struct K {}; + +template <typename C, typename IteratorPolicy> +class Foo {}; + +template <typename C, template<typename> typename TTP> +using Bar = Foo<C, K<TTP>>; + +void s() { + Bar(1); // { dg-error "failed|no match" } +}
reply other threads:[~2024-05-01 20:31 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=20240501203153.D5FCE384AB48@sourceware.org \ --to=jason@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).