https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123644

            Bug ID: 123644
           Summary: capture of argument from a lambda in an unevaulated
                    location in default argument for class function
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, c++-lambda
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
struct Bob {
    void method(int p, int = sizeof([p]{
        return p;
    }()));
    static void stfunc(int p, int = sizeof([p]{
        return p;
    }()));
};

//void func(int p, int = sizeof([p]{
 //       return p;
 //   }()));
```

GCC incorrectly accepts these two. But if the function declaration is out of
the class, GCC will reject the use of p here.

Reply via email to