Bug ID: 78019
           Summary: Local class with lambda in default member initializer
                    cannot default-capture this
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot
  Target Milestone: ---

int main() {
    struct A {
        int x, i = [&] { return x; }();
    } a{0};

> error: 'this' was not captured for this lambda function 

Making the default-capture `=' doesn't help, but explicitly capturing `this'

Reply via email to