https://llvm.org/bugs/show_bug.cgi?id=30859
Bug ID: 30859 Summary: Bogus access error when befriending a member function template specialization Product: clang Version: trunk Hardware: All OS: All Status: NEW Severity: normal Priority: P Component: C++ Assignee: unassignedclangb...@nondot.org Reporter: rs2...@gmail.com CC: dgre...@apple.com, llvm-bugs@lists.llvm.org Classification: Unclassified >From http://stackoverflow.com/q/40350327/2756719. Repro: struct X { template <class T> static void f() { g<T>(); } private: template <class T> static void g() {}; }; struct Y { friend void X::f<Y>(); /// #1 }; int main() { X::f<Y>(); } results in the following obviously bogus error: prog.cc:3:42: error: 'g' is a private member of 'X' template <class T> static void f() { g<T>(); } ^~~~ prog.cc:15:8: note: in instantiation of function template specialization 'X::f<Y>' requested here X::f<Y>(); ^ prog.cc:5:36: note: declared private here template <class T> static void g() {}; ^ 1 error generated. Commenting out line #1 makes the code compile, suggesting that somehow the friend declaration caused the access checking to be done in the wrong context. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs