We walk the lambda captures in cp_walk_subtrees, so we don't also need to
walk them here.

Tested x86_64-pc-linux-gnu, applying to trunk.

gcc/cp/ChangeLog
2020-05-11  Jason Merrill  <ja...@redhat.com>

        * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
        walking of capture list.
---
 gcc/cp/pt.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index c6091127225..112426af72a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3988,18 +3988,12 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, 
void* data)
 
     case LAMBDA_EXPR:
       {
-       /* Look at explicit captures.  */
-       for (tree cap = LAMBDA_EXPR_CAPTURE_LIST (t);
-            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 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;
        return NULL_TREE;
       }
 

base-commit: 2b2d298ff845ab7a07ffbd51da79473736da3324
-- 
2.18.1

Reply via email to