diff options
author | Jason Merrill <jason@redhat.com> | 2022-01-26 10:40:42 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-01-26 11:39:40 -0500 |
commit | 00d8321124123daf41f7c51526355a5a610cdeb8 (patch) | |
tree | 9f0e89b6661f1a045f06227d17bbbde07a4939c0 | |
parent | 1bc00a489086b0bdde89ccb11dfa4f50b6c4e8f0 (diff) | |
download | gcc-00d8321124123daf41f7c51526355a5a610cdeb8.zip gcc-00d8321124123daf41f7c51526355a5a610cdeb8.tar.gz gcc-00d8321124123daf41f7c51526355a5a610cdeb8.tar.bz2 |
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.
-rw-r--r-- | gcc/cp/parser.cc | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/template-keyword2.C | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index ed219d7..8b38165 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 0000000..ecd0667 --- /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<>(); } +}; |