This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/86392] templatized friend member function needs declaration
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Jul 2018 15:44:12 +0000
- Subject: [Bug c++/86392] templatized friend member function needs declaration
- Auto-submitted: auto-generated
- References: <bug-86392-4@http.gcc.gnu.org/bugzilla/>
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.