public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102791] New: Friend declaration of lambda function is ignored
@ 2021-10-15 20:45 fchelnokov at gmail dot com
  2021-10-15 20:50 ` [Bug c++/102791] " pinskia at gcc dot gnu.org
  2023-11-09 12:48 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: fchelnokov at gmail dot com @ 2021-10-15 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102791
           Summary: Friend declaration of lambda function is ignored
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

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

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

* [Bug c++/102791] Friend declaration of lambda function is ignored
  2021-10-15 20:45 [Bug c++/102791] New: Friend declaration of lambda function is ignored fchelnokov at gmail dot com
@ 2021-10-15 20:50 ` pinskia at gcc dot gnu.org
  2023-11-09 12:48 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-15 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-10-15
             Blocks|                            |54367
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54367
[Bug 54367] [meta-bug] lambda expressions

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

* [Bug c++/102791] Friend declaration of lambda function is ignored
  2021-10-15 20:45 [Bug c++/102791] New: Friend declaration of lambda function is ignored fchelnokov at gmail dot com
  2021-10-15 20:50 ` [Bug c++/102791] " pinskia at gcc dot gnu.org
@ 2023-11-09 12:48 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ 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=102791

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |richard-gccbugzilla@metafoo
                   |                            |.co.uk

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 112455 has been marked as a duplicate of this bug. ***

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 20:45 [Bug c++/102791] New: Friend declaration of lambda function is ignored fchelnokov at gmail dot com
2021-10-15 20:50 ` [Bug c++/102791] " pinskia at gcc dot gnu.org
2023-11-09 12:48 ` 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).