public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96193] New: No ADL for hidden friend in call with explicit template arguments
@ 2020-07-14  7:31 johelegp at gmail dot com
  2020-07-14  7:34 ` [Bug c++/96193] " johelegp at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: johelegp at gmail dot com @ 2020-07-14  7:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96193
           Summary: No ADL for hidden friend in call with explicit
                    template arguments
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/qhEfGd.
```C++
struct B
{
    template <class U>
    friend void f(B)
    {
    }
};

void g()
{
    f<int>(B{});
}
```

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

* [Bug c++/96193] No ADL for hidden friend in call with explicit template arguments
  2020-07-14  7:31 [Bug c++/96193] New: No ADL for hidden friend in call with explicit template arguments johelegp at gmail dot com
@ 2020-07-14  7:34 ` johelegp at gmail dot com
  2020-07-14  9:06 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: johelegp at gmail dot com @ 2020-07-14  7:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
That actually compiles if I add -std=c++20. If the call is itself dependent, it
fails to compile. See https://godbolt.org/z/KqGhKE.
```C++
template <class T>
struct B
{
    template <class U>
    friend void f(B)
    {
    }
};

template <class T>
struct X
{
    template <class U>
    friend void f(const X& x)
    {
        f<U>(B<T>{});
    }
};

void g()
{
    f<int>(X<int>{});
}
```

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

* [Bug c++/96193] No ADL for hidden friend in call with explicit template arguments
  2020-07-14  7:31 [Bug c++/96193] New: No ADL for hidden friend in call with explicit template arguments johelegp at gmail dot com
  2020-07-14  7:34 ` [Bug c++/96193] " johelegp at gmail dot com
@ 2020-07-14  9:06 ` redi at gcc dot gnu.org
  2020-07-14 17:41 ` johelegp at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-14  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Johel Ernesto Guerrero Peña from comment #1)
> That actually compiles if I add -std=c++20.

That is correct, isn't it?
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0846r0.html is a C++20
feature.

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

* [Bug c++/96193] No ADL for hidden friend in call with explicit template arguments
  2020-07-14  7:31 [Bug c++/96193] New: No ADL for hidden friend in call with explicit template arguments johelegp at gmail dot com
  2020-07-14  7:34 ` [Bug c++/96193] " johelegp at gmail dot com
  2020-07-14  9:06 ` redi at gcc dot gnu.org
@ 2020-07-14 17:41 ` johelegp at gmail dot com
  2020-07-25  3:26 ` [Bug c++/96193] No ADL in dependent " johelegp at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: johelegp at gmail dot com @ 2020-07-14 17:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Yes! I left it out expecting it to be backported as an extension like Clang
does.

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

* [Bug c++/96193] No ADL in dependent call with explicit template arguments
  2020-07-14  7:31 [Bug c++/96193] New: No ADL for hidden friend in call with explicit template arguments johelegp at gmail dot com
                   ` (2 preceding siblings ...)
  2020-07-14 17:41 ` johelegp at gmail dot com
@ 2020-07-25  3:26 ` johelegp at gmail dot com
  2021-08-04  6:05 ` pinskia at gcc dot gnu.org
  2021-08-04 11:47 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: johelegp at gmail dot com @ 2020-07-25  3:26 UTC (permalink / raw)
  To: gcc-bugs

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

Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://godbolt.org/z/E64Pb
                   |                            |b
            Summary|No ADL in call with         |No ADL in dependent call
                   |explicit template arguments |with explicit template
                   |within templated hidden     |arguments
                   |friend                      |

--- Comment #4 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
It actually fails for dependent calls. See https://godbolt.org/z/E64Pbb.
```C++
namespace ns {
  template <class T> struct X { };
  template <class T> constexpr void adl(X<T>) { }
}
template <class V> void f() { adl<int>(ns::X<V>{}); }
void g() { f<int>(); }
```

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

* [Bug c++/96193] No ADL in dependent call with explicit template arguments
  2020-07-14  7:31 [Bug c++/96193] New: No ADL for hidden friend in call with explicit template arguments johelegp at gmail dot com
                   ` (3 preceding siblings ...)
  2020-07-25  3:26 ` [Bug c++/96193] No ADL in dependent " johelegp at gmail dot com
@ 2021-08-04  6:05 ` pinskia at gcc dot gnu.org
  2021-08-04 11:47 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-04  6:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Johel Ernesto Guerrero Peña from comment #4)
> It actually fails for dependent calls. See https://godbolt.org/z/E64Pbb.

This seems to have been fixed in GCC 11+.

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

* [Bug c++/96193] No ADL in dependent call with explicit template arguments
  2020-07-14  7:31 [Bug c++/96193] New: No ADL for hidden friend in call with explicit template arguments johelegp at gmail dot com
                   ` (4 preceding siblings ...)
  2021-08-04  6:05 ` pinskia at gcc dot gnu.org
@ 2021-08-04 11:47 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-04 11:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It's accepted in C++20 mode since r11-3709

c++: Fix P0846 (ADL and function templates) in template [PR97010]

It was backported as r10-8915 for 10.3

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

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

end of thread, other threads:[~2021-08-04 11:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14  7:31 [Bug c++/96193] New: No ADL for hidden friend in call with explicit template arguments johelegp at gmail dot com
2020-07-14  7:34 ` [Bug c++/96193] " johelegp at gmail dot com
2020-07-14  9:06 ` redi at gcc dot gnu.org
2020-07-14 17:41 ` johelegp at gmail dot com
2020-07-25  3:26 ` [Bug c++/96193] No ADL in dependent " johelegp at gmail dot com
2021-08-04  6:05 ` pinskia at gcc dot gnu.org
2021-08-04 11:47 ` redi 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).