[pushed] c++: ->template and using-decl [PR104235]
Commit Message
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.
Tested x86_64-pc-linux-gnu, applying to trunk.
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.
---
gcc/cp/parser.cc | 3 ++-
gcc/testsuite/g++.dg/parse/template-keyword2.C | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/g++.dg/parse/template-keyword2.C
base-commit: 1bc00a489086b0bdde89ccb11dfa4f50b6c4e8f0
prerequisite-patch-id: c7ab4056fcbd782232c8dc091597602ecd4a7a48
@@ -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;
}
new file mode 100644
@@ -0,0 +1,8 @@
+// PR c++/104235
+
+template <class M>
+struct L: M {
+ using M::a;
+ void a();
+ void p() { this->template a<>(); }
+};