diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fc124b440bb..4a526b9b3a0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2018-03-14 Jason Merrill + PR c++/84801 - ICE with unexpanded pack in lambda. + * pt.c (check_for_bare_parameter_packs): Don't return early for a + lambda in non-template context. + PR c++/81236 - auto variable and auto function * pt.c (tsubst_baselink): Update the type of the BASELINK after mark_used. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2ea5fc79a2c..32af3a4822e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4043,7 +4043,8 @@ check_for_bare_parameter_packs (tree t) return false; /* A lambda might use a parameter pack from the containing context. */ - if (current_class_type && LAMBDA_TYPE_P (current_class_type)) + if (current_class_type && LAMBDA_TYPE_P (current_class_type) + && CLASSTYPE_TEMPLATE_INFO (current_class_type)) return false; if (TREE_CODE (t) == TYPE_DECL) diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic15.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic15.C new file mode 100644 index 00000000000..1de72712643 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic15.C @@ -0,0 +1,5 @@ +// PR c++/84801 +// { dg-do compile { target c++14 } } + +int v; +int main() { [](auto... c) { v = c; }(1); } // { dg-error "not expanded" }