| Summary: | befriending a lambda closure type doesn't grant access to the lambda body | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Richard Smith <richard-gccbugzilla> |
| Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | normal | CC: | webrown.cpp |
| Priority: | P3 | ||
| Version: | 14.0 | ||
| Target Milestone: | --- | ||
| Host: | Target: | ||
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | ||
Dup of bug 102791. *** This bug has been marked as a duplicate of bug 102791 *** |
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.