PR c++/84801 - ICE with unexpanded pack in lambda.

We avoid complaining about unexpanded packs when inside a lambda,
	since the lambda as a whole could be part of a pack expansion.
	But that can only be true if the lambda is in a template context.

   	* pt.c (check_for_bare_parameter_packs): Don't return early for a
	lambda in non-template context.

From-SVN: r258548
This commit is contained in:
Jason Merrill 2018-03-14 23:49:07 -04:00 committed by Jason Merrill
parent b149eb04c8
commit e62d673d78
3 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2018-03-14 Jason Merrill <jason@redhat.com>
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.

View File

@ -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)

View File

@ -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" }