public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112455] New: befriending a lambda closure type doesn't grant access to the lambda body
@ 2023-11-09  8:39 richard-gccbugzilla at metafoo dot co.uk
  2023-11-09 12:48 ` [Bug c++/112455] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2023-11-09  8:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112455

            Bug ID: 112455
           Summary: befriending a lambda closure type doesn't grant access
                    to the lambda body
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard-gccbugzilla at metafoo dot co.uk
  Target Milestone: ---

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/112455] befriending a lambda closure type doesn't grant access to the lambda body
  2023-11-09  8:39 [Bug c++/112455] New: befriending a lambda closure type doesn't grant access to the lambda body richard-gccbugzilla at metafoo dot co.uk
@ 2023-11-09 12:48 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-09 12:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112455

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 102791.

*** This bug has been marked as a duplicate of bug 102791 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-09 12:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09  8:39 [Bug c++/112455] New: befriending a lambda closure type doesn't grant access to the lambda body richard-gccbugzilla at metafoo dot co.uk
2023-11-09 12:48 ` [Bug c++/112455] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).