diff options
author | Adam Butcher <adam@jessamine.co.uk> | 2014-02-18 21:07:48 +0000 |
---|---|---|
committer | Adam Butcher <abutcher@gcc.gnu.org> | 2014-02-18 21:07:48 +0000 |
commit | b19fd0fd71f4ffb3f01d9b4a6333b38744e13c64 (patch) | |
tree | 24a76ab51571fc0f1b3a8c4ade8ab33c9fa88478 /gcc | |
parent | 223cdd1548cadbcf2ae3eee4931e569b4c603f96 (diff) | |
download | gcc-b19fd0fd71f4ffb3f01d9b4a6333b38744e13c64.zip gcc-b19fd0fd71f4ffb3f01d9b4a6333b38744e13c64.tar.gz gcc-b19fd0fd71f4ffb3f01d9b4a6333b38744e13c64.tar.bz2 |
re PR c++/60190 ([c++1y] ICE with invalid return type of template lambda)
Fix PR c++/60190.
PR c++/60190
* parser.c (cp_parser_lambda_declarator_opt): Pop template parameter
scope whenever a template parameter list has been started, independent
of whether the function call operator was well-formed or not.
PR c++/60190
* g++.dg/cpp1y/pr60190.C: New testcase.
From-SVN: r207852
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/parser.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/pr60190.C | 5 |
4 files changed, 25 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3d2c6b2..b0fd4b7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2014-02-18 Adam Butcher <adam@jessamine.co.uk> + + PR c++/60190 + * parser.c (cp_parser_lambda_declarator_opt): Pop template parameter + scope whenever a template parameter list has been started, independent + of whether the function call operator was well-formed or not. + 2014-02-12 Paolo Carlini <paolo.carlini@oracle.com> PR c++/60047 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f0722d6..23d54fb 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -9127,15 +9127,15 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) DECL_ARTIFICIAL (fco) = 1; /* Give the object parameter a different name. */ DECL_NAME (DECL_ARGUMENTS (fco)) = get_identifier ("__closure"); - if (template_param_list) - { - fco = finish_member_template_decl (fco); - finish_template_decl (template_param_list); - --parser->num_template_parameter_lists; - } - else if (parser->fully_implicit_function_template_p) - fco = finish_fully_implicit_template (parser, fco); } + if (template_param_list) + { + fco = finish_member_template_decl (fco); + finish_template_decl (template_param_list); + --parser->num_template_parameter_lists; + } + else if (parser->fully_implicit_function_template_p) + fco = finish_fully_implicit_template (parser, fco); finish_member_declaration (fco); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 430ea45..cd31dd9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-02-18 Adam Butcher <adam@jessamine.co.uk> + + PR c++/60190 + * g++.dg/cpp1y/pr60190.C: New testcase. + 2014-02-18 Uros Bizjak <ubizjak@gmail.com> PR target/60205 diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60190.C b/gcc/testsuite/g++.dg/cpp1y/pr60190.C new file mode 100644 index 0000000..d5e2567 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60190.C @@ -0,0 +1,5 @@ +// PR c++/60190 +// { dg-do compile } +// { dg-options "-std=c++1y" } + +auto f = []<int>() -> int() {}; // { dg-error "returning a function|expected" } |