Jason, looking at 61636 I can't determine what the correct behaviour should be.

I've reduced the testcase further to:
struct A {
  void b ();
  void Foo (int);
};

void A::b() {

  auto lam = [&](auto asdf) {
    Foo (asdf);
  };

  lam (0);
}

which avoids nullptr_t. The compiler's confused about whether the this pointer should be captured. When parsing the lambda body, we're effectively in template parsing context, because this is a generic lambda. That means the expression 'Foo (asdf)' has a type-dependent argument, and we defer the overload resolution until instantiation time. so we don't capture the this pointer. And things go wrong from there.

AFAICT 5.1.2 doesn't anticipate this. A generic lambda's closure type is not described as a template type itself -- only the function and conversion operators are templates. That doesn't seem to allow for 'this' capture to be conditionally added to the capture set.

What's the intent here?

nathan
--
Nathan Sidwell

Reply via email to