Commit aaa15a0d by Adam Butcher Committed by Adam Butcher

re PR c++/59638 ([c++1y] ICE with pointer to function that has auto as parameter)

Fix PR c++/59638

	PR c++/59638
	* cp/parser.c (cp_parser_init_declarator): Undo fully implicit
	template parameter list when declarator is not a function.

	* g++.dg/cpp1y/pr59638.C: New testcase.

From-SVN: r206371
parent 2418d7da
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
* cp/parser.c (cp_parser_lambda_expression): Save/reset/restore * cp/parser.c (cp_parser_lambda_expression): Save/reset/restore
auto_is_implicit_function_template_parm_p around lambda body. auto_is_implicit_function_template_parm_p around lambda body.
PR c++/59638
* cp/parser.c (cp_parser_init_declarator): Undo fully implicit
template parameter list when declarator is not a function.
2014-01-03 Marc Glisse <marc.glisse@inria.fr> 2014-01-03 Marc Glisse <marc.glisse@inria.fr>
PR c++/58950 PR c++/58950
......
...@@ -16780,6 +16780,15 @@ cp_parser_init_declarator (cp_parser* parser, ...@@ -16780,6 +16780,15 @@ cp_parser_init_declarator (cp_parser* parser,
warning (OPT_Wattributes, warning (OPT_Wattributes,
"attributes after parenthesized initializer ignored"); "attributes after parenthesized initializer ignored");
/* A non-template declaration involving a function parameter list containing
an implicit template parameter will have been made into a template. If it
turns out that the resulting declaration is not an actual function then
finish the template declaration here. An error message will already have
been issued. */
if (parser->fully_implicit_function_template_p)
if (!function_declarator_p (declarator))
finish_fully_implicit_template (parser, /*member_decl_opt=*/0);
/* For an in-class declaration, use `grokfield' to create the /* For an in-class declaration, use `grokfield' to create the
declaration. */ declaration. */
if (member_p) if (member_p)
......
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
PR c++/59635 PR c++/59635
PR c++/59636 PR c++/59636
PR c++/59629 PR c++/59629
PR c++/59638
* g++.dg/cpp1y/pr59635.C: New testcase. * g++.dg/cpp1y/pr59635.C: New testcase.
* g++.dg/cpp1y/pr59636.C: New testcase. * g++.dg/cpp1y/pr59636.C: New testcase.
* g++.dg/cpp1y/pr59629.C: New testcase. * g++.dg/cpp1y/pr59629.C: New testcase.
* g++.dg/cpp1y/pr59638.C: New testcase.
2014-01-06 Martin Jambor <mjambor@suse.cz> 2014-01-06 Martin Jambor <mjambor@suse.cz>
......
// { dg-do compile }
// { dg-options "-std=gnu++1y" }
// PR c++/59638
void (*a)(auto); // { dg-error "template declaration" }
void (*b)(auto) = 0; // { dg-error "template declaration" }
typedef void (*f)(auto); // { dg-error "template declaration" }
struct A
{
int i;
};
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