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 r12-6879] c++: ->template and using-decl [PR104235] Date: Wed, 26 Jan 2022 16:39:46 +0000 (GMT) [thread overview] Message-ID: <20220126163946.952833851409@sourceware.org> (raw) https://gcc.gnu.org/g:00d8321124123daf41f7c51526355a5a610cdeb8 commit r12-6879-g00d8321124123daf41f7c51526355a5a610cdeb8 Author: Jason Merrill <jason@redhat.com> Date: Wed Jan 26 10:40:42 2022 -0500 c++: ->template and using-decl [PR104235] cp_parser_template_id wasn't prepared to handle getting a USING_DECL back from cp_parser_template_name. Let's defer that case to instantiation time, as well. PR c++/104235 gcc/cp/ChangeLog: * parser.cc (cp_parser_template_name): Repeat lookup of USING_DECL. gcc/testsuite/ChangeLog: * g++.dg/parse/template-keyword2.C: New test. Diff: --- gcc/cp/parser.cc | 3 ++- gcc/testsuite/g++.dg/parse/template-keyword2.C | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index ed219d79dc9..8b38165020f 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -18680,7 +18680,8 @@ cp_parser_template_name (cp_parser* parser, cp_parser_error (parser, "expected template-name"); return error_mark_node; } - else if (!DECL_P (decl) && !is_overloaded_fn (decl)) + else if ((!DECL_P (decl) && !is_overloaded_fn (decl)) + || TREE_CODE (decl) == USING_DECL) /* Repeat the lookup at instantiation time. */ decl = identifier; } diff --git a/gcc/testsuite/g++.dg/parse/template-keyword2.C b/gcc/testsuite/g++.dg/parse/template-keyword2.C new file mode 100644 index 00000000000..ecd066787bc --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/template-keyword2.C @@ -0,0 +1,8 @@ +// PR c++/104235 + +template <class M> +struct L: M { + using M::a; + void a(); + void p() { this->template a<>(); } +};
reply other threads:[~2022-01-26 16: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=20220126163946.952833851409@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).