From fc186cbd1cdff6cecdb8eb0a350c3ee0af2d1332 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 11 Aug 2018 06:47:03 -0400 Subject: [PATCH] PR c++/86728 - C variadic generic lambda. * parser.c (cp_parser_parameter_declaration): Don't turn 'auto' into a pack if it's followed by a declarator-id. From-SVN: r263484 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 3 ++- gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic19.C | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic19.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8a3e1507704..fc0771aa7f2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-08-10 Jason Merrill + + PR c++/86728 - C variadic generic lambda. + * parser.c (cp_parser_parameter_declaration): Don't turn 'auto' into + a pack if it's followed by a declarator-id. + 2018-08-08 Jakub Jelinek P0595R1 - is_constant_evaluated diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 93c812f80d7..8cfcd150705 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -21722,7 +21722,8 @@ cp_parser_parameter_declaration (cp_parser *parser, parameter was introduced during cp_parser_parameter_declaration, change any implicit parameters introduced into packs. */ if (parser->implicit_template_parms - && (token->type == CPP_ELLIPSIS + && ((token->type == CPP_ELLIPSIS + && declarator_can_be_parameter_pack (declarator)) || (declarator && declarator->parameter_pack_p))) { int latest_template_parm_idx = TREE_VEC_LENGTH diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic19.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic19.C new file mode 100644 index 00000000000..e78677de0b5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic19.C @@ -0,0 +1,4 @@ +// PR c++/86728 +// { dg-do compile { target c++14 } } + +auto c = [](auto x ...) { }; -- 2.30.2