OK.

On Thu, Dec 15, 2016 at 7:38 AM, Nathan Sidwell <nat...@acm.org> wrote:
> 77585 concerns the instantiation of a generic lambda that contains a call to
> a non-dependent non-static member function.
>
>   auto lam = [&](auto) { return Share (); };
>   r += Eat (lam);  // instantation of lambda::operator() here
>
> During instantiation of the call to Share, maybe_resolve_dummy gets called
> and uses current_nonlambda_class_type, which peeks up the
> current_current_class stack.
>
> That peeking presupposes we're actually pushing and popping class scopes as
> we enter them all the way from the global scope.  But that doesn't always
> happen in instantiation.  push_nested_class pushes the immediately enclosing
> scopes, but stops at function scope.  So we don't get the class scope of
> that function pushed.  Thus stack peeking fails.
>
> This hasn't previously been an instantiation problem, because templates
> couldn't be defined at local scope.  But generic lambdas now have that
> property (wrt this capture at least).
>
> This patch amends instantiate_decl to first push the containing non-lambda
> class scope before start_preparsed_function does its stack pushing.
>
> ok?
>
> nathan
> --
> Nathan Sidwell

Reply via email to