Commit 7ab50e17 by Jason Merrill Committed by Jason Merrill

PR c++/82070 - error with nested lambda capture

	* pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with
	register_local_specialization.

From-SVN: r251819
parent bbd35101
2017-09-06 Jason Merrill <jason@redhat.com>
PR c++/82070 - error with nested lambda capture
* pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with
register_local_specialization.
2017-09-06 Nathan Sidwell <nathan@acm.org> 2017-09-06 Nathan Sidwell <nathan@acm.org>
* name-lookup.h (lookup_field_1): Delete. * name-lookup.h (lookup_field_1): Delete.
......
...@@ -15985,8 +15985,11 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, ...@@ -15985,8 +15985,11 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
else if (is_capture_proxy (decl) else if (is_capture_proxy (decl)
&& !DECL_TEMPLATE_INSTANTIATION (current_function_decl)) && !DECL_TEMPLATE_INSTANTIATION (current_function_decl))
{ {
/* We're in tsubst_lambda_expr, we've already inserted new capture /* We're in tsubst_lambda_expr, we've already inserted a new
proxies, and uses will find them with lookup_name. */ capture proxy, so look it up and register it. */
tree inst = lookup_name (DECL_NAME (decl));
gcc_assert (inst != decl && is_capture_proxy (inst));
register_local_specialization (inst, decl);
break; break;
} }
else if (DECL_IMPLICIT_TYPEDEF_P (decl) else if (DECL_IMPLICIT_TYPEDEF_P (decl)
......
// PR c++/82070
// { dg-do compile { target c++11 } }
namespace a {
template <typename b>
void
c (int, int, b d)
{
[d] { [d] {}; };
}
}
void
e ()
{
int f;
a::c (f, 3, [] {});
}
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