By the time we get to the lower have of cp_parser_template_name, we
don't need to keep the USING_DECL around, we can strip it away and just
deal with the underlying template.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit 0c6a93e343cbd6ce5c5c341b65eca721b58dae46
Author: Jason Merrill <ja...@redhat.com>
Date: Mon Mar 16 09:40:04 2015 -0400
PR c++/65061
* parser.c (cp_parser_template_name): Call strip_using_decl.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index a209ee6..a18f38c 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -14051,6 +14051,8 @@ cp_parser_template_name (cp_parser* parser,
/*ambiguous_decls=*/NULL,
token->location);
+ decl = strip_using_decl (decl);
+
/* If DECL is a template, then the name was a template-name. */
if (TREE_CODE (decl) == TEMPLATE_DECL)
{
diff --git a/gcc/testsuite/g++.dg/inherit/using8.C b/gcc/testsuite/g++.dg/inherit/using8.C
new file mode 100644
index 0000000..b7677c8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/using8.C
@@ -0,0 +1,15 @@
+// PR c++/65061
+
+struct B
+{
+ template<typename T>
+ struct S {};
+};
+
+struct D : B
+{
+ using B::S;
+
+ template<typename T>
+ void doIt(/*struct*/ S<T>&);
+};