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

            Bug ID: 91618
           Summary: template-id required to friend a function template,
                    even for a qualified-id
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

Reduced from StackOverflow (https://stackoverflow.com/q/57730286/2069064):

template <class T> void f(T);

struct A {
    friend void ::f(A);
};

gcc rejects this with:

source>:4:22: error: 'void f(A)' should have been declared inside '::'
    4 |     friend void ::f(A);
      |                      ^

gcc accepts:

template <class T> void f(T);

struct A {
    friend void ::f<>(A);
};

But [temp.friend]/1.3 says that qualified-ids can find matching function
templates... I shouldn't need to provide a template-id.

Reply via email to