diff options
author | Adam Butcher <adam@jessamine.co.uk> | 2014-01-06 18:22:48 +0000 |
---|---|---|
committer | Adam Butcher <abutcher@gcc.gnu.org> | 2014-01-06 18:22:48 +0000 |
commit | aaa15a0d0823654d69cb9d4d751a0ecf3ed6ee49 (patch) | |
tree | 1e4273cb2afc2469f6936ed8e0f777111a8fa88b /gcc | |
parent | 2418d7da3a08b5ea0c2e59a2e078193b70980b48 (diff) | |
download | gcc-aaa15a0d0823654d69cb9d4d751a0ecf3ed6ee49.zip gcc-aaa15a0d0823654d69cb9d4d751a0ecf3ed6ee49.tar.gz gcc-aaa15a0d0823654d69cb9d4d751a0ecf3ed6ee49.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/parser.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/pr59638.C | 16 |
4 files changed, 31 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c585946..16abb96 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -12,6 +12,10 @@ * cp/parser.c (cp_parser_lambda_expression): Save/reset/restore 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> PR c++/58950 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 6668f2c..8c61520 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -16780,6 +16780,15 @@ cp_parser_init_declarator (cp_parser* parser, warning (OPT_Wattributes, "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 declaration. */ if (member_p) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 036b91a..80113ab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,9 +3,11 @@ PR c++/59635 PR c++/59636 PR c++/59629 + PR c++/59638 * g++.dg/cpp1y/pr59635.C: New testcase. * g++.dg/cpp1y/pr59636.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> diff --git a/gcc/testsuite/g++.dg/cpp1y/pr59638.C b/gcc/testsuite/g++.dg/cpp1y/pr59638.C new file mode 100644 index 0000000..cd9dcdf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr59638.C @@ -0,0 +1,16 @@ +// { 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; +}; |