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

            Bug ID: 86180
           Summary: Friend function definition not instantiated in certain
                    circumstances
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

The following code compiles fine on clang++:

template<typename T> 
struct provide {
  friend T f() { return T(); }
};

void g() {
  void f();
  provide<void> p;
  f();
}

int main() {
  g();
}

However, gcc++ reports that it cannot find the definition of f. 

Indeed, a previous version of clang++ cannot compile the above code either. It
was fixed in https://bugs.llvm.org/show_bug.cgi?id=9518

I believe that gcc++ shall also fix the bug, right?

Reply via email to