Commit d1d1af10 by Adam Butcher Committed by Adam Butcher

Disallow implicit function templates in local functions unless defining a lambda.

gcc/cp/
	PR c++/59112
	PR c++/59113
	* parser.c (cp_parser_parameter_declaration_clause): Disallow implicit
	function templates in local functions unless defining a lambda.

gcc/testsuite/
	PR c++/59112
	PR c++/59113
	g++.dg/cpp1y/pr58533.C: Updated testcase.
	g++.dg/cpp1y/pr59112.C: New testcase.
	g++.dg/cpp1y/pr59113.C: New testcase.

From-SVN: r205343
parent 02231c13
2013-11-25 Adam Butcher <adam@jessamine.co.uk>
PR c++/59112
PR c++/59113
* parser.c (cp_parser_parameter_declaration_clause): Disallow implicit
function templates in local functions unless defining a lambda.
2013-11-23 Easwaran Raman <eraman@google.com>
PR c++/59031
......
......@@ -18042,7 +18042,9 @@ cp_parser_parameter_declaration_clause (cp_parser* parser)
(void) cleanup;
if (!processing_specialization)
parser->auto_is_implicit_function_template_parm_p = true;
if (!current_function_decl
|| (current_class_type && LAMBDA_TYPE_P (current_class_type)))
parser->auto_is_implicit_function_template_parm_p = true;
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
......
2013-11-25 Adam Butcher <adam@jessamine.co.uk>
PR c++/59112
PR c++/59113
g++.dg/cpp1y/pr58533.C: Updated testcase.
g++.dg/cpp1y/pr59112.C: New testcase.
g++.dg/cpp1y/pr59113.C: New testcase.
2013-11-25 Terry Guo <terry.guo@arm.com>
* gcc.target/arm/thumb2-slow-flash-data.c: New.
......
......@@ -3,5 +3,5 @@
void foo()
{
void (*fp)(auto); // { dg-error "template" }
void (*fp)(auto); // { dg-error "auto|not permitted" }
}
// { dg-do compile }
// { dg-options "-std=gnu++1y" }
// PR c++/59112
void foo()
{
struct A
{
A(auto) {} // { dg-error "auto|not permitted" }
};
}
// { dg-do compile }
// { dg-options "-std=gnu++1y" }
// PR c++/59113
void foo()
{
void bar(auto) {} // { dg-error "function-definition|auto|not permitted" }
}
auto i = 0;
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