This is a valid program: ``` constexpr auto f = [](auto& x){ x.m(); }; class A{ friend decltype(f); void m() {} public: void n() { f(*this); } }; int main(){ A{}.n(); } ``` which is accepted by Clang and MSVC, but unfortunately not by GCC. The error is ``` error: 'void A::m()' is private within this context 2 | x.m(); ``` Demo: https://gcc.godbolt.org/z/vKnhqG9b1 Related discussion: https://stackoverflow.com/q/64390688/7325599
Confirmed.
*** Bug 112455 has been marked as a duplicate of this bug. ***