Commit b1c7b29a by Jason Merrill Committed by Jason Merrill

PR c++/84091 - ICE with local class in lambda in template.

	* decl2.c (determine_visibility): Look for outer containing template
	instantiation.

From-SVN: r257202
parent 8d79f003
2018-01-30 Jason Merrill <jason@redhat.com>
PR c++/84091 - ICE with local class in lambda in template.
* decl2.c (determine_visibility): Look for outer containing template
instantiation.
PR c++/84098 - ICE with lambda in template NSDMI.
* pt.c (instantiate_class_template_1): Ignore more lambdas.
......
......@@ -2418,6 +2418,16 @@ determine_visibility (tree decl)
by that. */
if (DECL_LANG_SPECIFIC (fn) && DECL_USE_TEMPLATE (fn))
template_decl = fn;
else if (template_decl)
{
/* FN must be a regenerated lambda function, since they don't
have template arguments. Find a containing non-lambda
template instantiation. */
tree ctx = fn;
while (ctx && !get_template_info (ctx))
ctx = get_containing_scope (ctx);
template_decl = ctx;
}
}
else if (VAR_P (decl) && DECL_TINFO_P (decl)
&& flag_visibility_ms_compat)
......
// PR c++/84091
// { dg-do compile { target c++11 } }
template < typename > void f ()
{
[] { struct A {} a; } ();
}
int main ()
{
f < int > ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment