* parser.c (synthesize_implicit_template_parm): Inject new template
argument list appropriately when a generic member function
of a class template is declared out-of-line.
* g++.dg/cpp1y/fn-generic-member-ool.C: New testcase.
From-SVN: r208107
2014-02-25 Adam Butcher <adam@jessamine.co.uk>
+ * parser.c (synthesize_implicit_template_parm): Inject new template
+ argument list appropriately when a generic member function
+ of a class template is declared out-of-line.
+
PR c++/60065
* parser.c (cp_parser_direct_declarator): Don't save and
restore num_template_parameter_lists around call to
current_binding_level = scope;
- if (scope->kind != sk_template_parms)
+ if (scope->kind != sk_template_parms
+ || !function_being_declared_is_template_p (parser))
{
/* Introduce a new template parameter list for implicit template
parameters. */
2014-02-25 Adam Butcher <adam@jessamine.co.uk>
+ * g++.dg/cpp1y/fn-generic-member-ool.C: New testcase.
+
PR c++/60065
* g++.dg/cpp1y/pr60065.C: New testcase.
--- /dev/null
+// Out-of-line generic member function definitions.
+// { dg-options "-std=c++1y" }
+
+struct A {
+ void f(auto x);
+};
+
+void A::f(auto x) {} // injects a new list
+
+template <typename T>
+struct B {
+ void f(auto x);
+};
+
+template <typename T>
+void B<T>::f(auto x) {} // injects a new list
+
+struct C {
+ template <int N>
+ void f(auto x);
+};
+
+template <int N>
+void C::f(auto x) {} // extends existing inner list
+
+template <typename T>
+struct D
+{
+ template <int N>
+ void f(auto x);
+};
+
+template <typename T>
+template <int N>
+void D<T>::f(auto x) {} // extends existing inner list