https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121677
Bug ID: 121677 Summary: Lambda implementation leaks out to user code Product: gcc Version: 15.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: csaba_22 at yahoo dot co.uk Target Milestone: --- The following code compiles and returns zero: int main() { int i = 42; auto f = [&i] () { return i * 2; }; // not called f.__i = 13; return i != 13; } This should not happen. __i is not defined anywhere (clang and msvc reject the code because of this). User code should not have access to the internal implementation of lambdas. This goes back to at least GCC 5, and is still present in GCC 15 (and even trunk) https://godbolt.org/z/aEaEeabav