Commit 1b859733 by Adam Butcher Committed by Adam Butcher

Fix out-of-line definition of class template generic member functions.

	* 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
parent 81493f78
2014-02-25 Adam Butcher <adam@jessamine.co.uk> 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 PR c++/60065
* parser.c (cp_parser_direct_declarator): Don't save and * parser.c (cp_parser_direct_declarator): Don't save and
restore num_template_parameter_lists around call to restore num_template_parameter_lists around call to
......
...@@ -31942,7 +31942,8 @@ synthesize_implicit_template_parm (cp_parser *parser) ...@@ -31942,7 +31942,8 @@ synthesize_implicit_template_parm (cp_parser *parser)
current_binding_level = scope; 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 /* Introduce a new template parameter list for implicit template
parameters. */ parameters. */
......
2014-02-25 Adam Butcher <adam@jessamine.co.uk> 2014-02-25 Adam Butcher <adam@jessamine.co.uk>
* g++.dg/cpp1y/fn-generic-member-ool.C: New testcase.
PR c++/60065 PR c++/60065
* g++.dg/cpp1y/pr60065.C: New testcase. * g++.dg/cpp1y/pr60065.C: New testcase.
......
// 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment