Testcase: class C; auto x = []<typename MyC = C>(MyC *p) { return p->n; }; class C { int n; friend decltype(x); } c; int k = x(&c); This appears to be valid, and Clang, MSVC, and EDG accept, but GCC reports an access error. The templated operator() of the lambda is a member function of a friend of C, so should have access to C::n.
Dup of bug 102791. *** This bug has been marked as a duplicate of bug 102791 ***