https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95368
Bug ID: 95368 Summary: gcc things that a lambda capture is both const and mutable Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rafael at espindo dot la Target Milestone: --- gcc accepts #include <utility> struct foo { void func(); }; void bar(foo& v) { [v]() { static_assert(std::is_same_v<decltype(v), foo&>); [v]() mutable { static_assert(std::is_same_v<decltype(v), foo&>); // v.func(); }(); }(); } But uncomment the call and you get test.cc:12:20: error: passing ‘const foo’ as ‘this’ argument discards qualifiers [-fpermissive] 12 | v.func();