From: Jason Merrill Date: Tue, 19 Jun 2018 00:38:32 +0000 (-0400) Subject: PR c++/86200 - ICE with unexpanded pack in lambda parameter. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=44e3e545a30ef6425cb7fbfb48fbc01056233ae0;p=gcc.git PR c++/86200 - ICE with unexpanded pack in lambda parameter. * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the function type. From-SVN: r261726 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a8d0e626440..a6714762675 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2018-06-18 Jason Merrill + 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. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5af0f9afefc..b783b5e1436 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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 index 00000000000..c5355b0a8d8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic7.C @@ -0,0 +1,14 @@ +// PR c++/86200 +// { dg-do compile { target c++11 } } + +template +static void foo() +{ + [](Args, int x) { + x; + }; // { dg-error "packs not expanded" } +} +int main() +{ + foo(); +}