PR c++/86728 - C variadic generic lambda.
authorJason Merrill <jason@redhat.com>
Sat, 11 Aug 2018 10:47:03 +0000 (06:47 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 11 Aug 2018 10:47:03 +0000 (06:47 -0400)
* 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
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic19.C [new file with mode: 0644]

index 8a3e150..fc0771a 100644 (file)
@@ -1,3 +1,9 @@
+2018-08-10  Jason Merrill  <jason@redhat.com>
+
+       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  <jakub@redhat.com>
 
        P0595R1 - is_constant_evaluated
index 93c812f..8cfcd15 100644 (file)
@@ -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 (file)
index 0000000..e78677d
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/86728
+// { dg-do compile { target c++14 } }
+
+auto c = [](auto x ...) { };