https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92851
--- Comment #2 from Kohei Takahashi <flast at flast dot jp> --- (In reply to Jonathan Wakely from comment #1) > Please provide a complete testcase not a URL, as required by > https://gcc.gnu.org/bugs/ Sorry, here is reproducible complete code. ---- struct S { int a; void foo() const { [*this]() mutable { a = 0; }(); } }; ---- GCC rejects with following message, but clang not. ---- prog.cc: In lambda function: prog.cc:9:15: error: assignment of member 'S::a' in read-only object 9 | a = 0; | ~~^~~ ----