public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108303] New: lookup failes with requires clause on non-template friend function of a class template
@ 2023-01-05 17:20 ted at lyncon dot se
  2023-01-05 17:45 ` [Bug c++/108303] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ted at lyncon dot se @ 2023-01-05 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108303
           Summary: lookup failes with requires clause on non-template
                    friend function of a class template
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ted at lyncon dot se
  Target Milestone: ---

This works up to 12.2 (inclusive) on godbolt but fails on trunk:
```
template <typename Derived>
struct base {
    friend void foo(const Derived& d)
        requires requires { bar(d); } // removing this makes it work
    {
        bar(d);
    }
};

namespace adl {
struct S : base<S> {
    friend void bar(const S&) {}
};
}  // namespace adl

void test(adl::S const& s) {
    foo(s);  // error: 'foo' was not declared in this scope
}
```

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

* [Bug c++/108303] lookup failes with requires clause on non-template friend function of a class template
  2023-01-05 17:20 [Bug c++/108303] New: lookup failes with requires clause on non-template friend function of a class template ted at lyncon dot se
@ 2023-01-05 17:45 ` redi at gcc dot gnu.org
  2023-01-06  6:35 ` pinskia at gcc dot gnu.org
  2023-05-09 21:27 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-05 17:45 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Started to be rejected with r13-4035

c++: only declare satisfied friends

A friend declaration can only have constraints if it is defined.  If
multiple instantiations of a class template define the same friend function
signature, it's an error, but that shouldn't happen if it's constrained to
only be declared in one instantiation.

Currently we don't mangle requirements, so the foos all mangle the same and
actually instantiating #1 will break, but for now we can test that they're
considered distinct.

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

* [Bug c++/108303] lookup failes with requires clause on non-template friend function of a class template
  2023-01-05 17:20 [Bug c++/108303] New: lookup failes with requires clause on non-template friend function of a class template ted at lyncon dot se
  2023-01-05 17:45 ` [Bug c++/108303] " redi at gcc dot gnu.org
@ 2023-01-06  6:35 ` pinskia at gcc dot gnu.org
  2023-05-09 21:27 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-06  6:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> Currently we don't mangle requirements, so the foos all mangle the same and
> actually instantiating #1 will break, but for now we can test that they're
> considered distinct.

That would be PR 100825 .

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

* [Bug c++/108303] lookup failes with requires clause on non-template friend function of a class template
  2023-01-05 17:20 [Bug c++/108303] New: lookup failes with requires clause on non-template friend function of a class template ted at lyncon dot se
  2023-01-05 17:45 ` [Bug c++/108303] " redi at gcc dot gnu.org
  2023-01-06  6:35 ` pinskia at gcc dot gnu.org
@ 2023-05-09 21:27 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-09 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE
           See Also|https://gcc.gnu.org/bugzill |
                   |a/show_bug.cgi?id=109751    |

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Let's call this a dup of later reported PR109751 since it contains more
discussion/detail.

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

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

end of thread, other threads:[~2023-05-09 21:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05 17:20 [Bug c++/108303] New: lookup failes with requires clause on non-template friend function of a class template ted at lyncon dot se
2023-01-05 17:45 ` [Bug c++/108303] " redi at gcc dot gnu.org
2023-01-06  6:35 ` pinskia at gcc dot gnu.org
2023-05-09 21:27 ` ppalka 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).