]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/86200 - ICE with unexpanded pack in lambda parameter.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Jun 2018 00:38:32 +0000 (00:38 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Jun 2018 00:38:32 +0000 (00:38 +0000)
* pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the
function type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261726 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic7.C [new file with mode: 0644]

index a8d0e62644049f6c705a07841a66e8a07797238f..a671476267545fdfbd134ce75ac81fc7dae8fddc 100644 (file)
@@ -1,5 +1,9 @@
 2018-06-18  Jason Merrill  <jason@redhat.com>
 
+       PR c++/86200 - ICE with unexpanded pack in lambda parameter.
+       * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the
+       function type.
+
        PR c++/81060 - ICE with unexpanded parameter pack.
        * pt.c (check_for_bare_parameter_packs): Add loc parameter.
        * decl.c (grokdeclarator): Call it for qualifying_scope.
index 5af0f9afefc57b69e3afb930e699e843a87e86d4..b783b5e1436505211eefe44f1ec13bae453ab11b 100644 (file)
@@ -3839,8 +3839,10 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
             cap; cap = TREE_CHAIN (cap))
          cp_walk_tree (&TREE_VALUE (cap), &find_parameter_packs_r, ppd,
                        ppd->visited);
-       /* Since we defer implicit capture, look in the body as well.  */
+       /* Since we defer implicit capture, look in the parms and body.  */
        tree fn = lambda_function (t);
+       cp_walk_tree (&TREE_TYPE (fn), &find_parameter_packs_r, ppd,
+                     ppd->visited);
        cp_walk_tree (&DECL_SAVED_TREE (fn), &find_parameter_packs_r, ppd,
                      ppd->visited);
        *walk_subtrees = 0;
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic7.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic7.C
new file mode 100644 (file)
index 0000000..c5355b0
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/86200
+// { dg-do compile { target c++11 } }
+
+template<typename ... Args>
+static void foo()
+{
+  [](Args, int x) {
+    x;
+  };                           // { dg-error "packs not expanded" }
+}
+int main()
+{
+  foo();
+}