http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59294
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- This is not a bug (and GCC's bugzilla is not the right place for "is this valid?" questions). Name lookup FOR "conjugate" in class scope will find "Q::conjugate" not "::conjugate". To refer to the global function you would need to qualify it as ::conjugate, but then the compiler thinks you are referring to Q<T>::conjugate (the whitespace between the return type and the function identifier is not significant to the compiler.) The only way I can see to compile it is to declare the friend before the member function (although I think that technically makes the code ill-formed, because the standard says "A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S. No diagnostic is required for a violation of this rule."