This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/86392] templatized friend member function needs declaration


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

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

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to rene.rahn from comment #0)
> The same behaviour happens with clang, so I think I am just missing
> something here and I would appreciate a short explanation.

Reporting a bug is not really appropriate way to ask somebody to explain how
C++ works. You could have asked on the gcc-help mailing or somewhere like
stackoverflow.

When the compiler sees get<0 it doesn't know if it's parsing a template-name or
a comparison to zero. Unqualified name lookup is performed for the name "get",
and when it finds ::get<T> it knows that it's dealing with a template-name. The
rest of the expression get<0>(f) is then treated as a function call, and so
argument dependent lookup is performed for the type foo<int>, which finds the
friend function.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]