Open llvmbot opened 10 years ago
Smaller repro, fails to compile with clang r196769:
template <typename T>
struct x;
template<typename T>
struct y {
friend void x<T>::f(y);
};
This results in:
% ~/LLVM/build/Release+Asserts/bin/clang++ -c clang.cppclang.cpp:6:25: error: use of class template 'y' requires template arguments
friend void x<T>::f(y);
^
clang.cpp:5:8: note: template is declared here
struct y {
^
1 error generated.
Interestingly, if the befriended method in x is called y instead of f, I get an additional error:
template <typename T>
struct x;
template<typename T>
struct y {
friend void x<T>::y(y);
};
% ~/LLVM/build/Release+Asserts/bin/clang++ -c clang.cpp
clang.cpp:6:25: error: use of class template 'y' requires template arguments
friend void x<T>::y(y);
^
clang.cpp:5:8: note: template is declared here
struct y {
^
clang.cpp:6:23: error: constructor cannot have a return type
friend void x<T>::y(y);
~~~~ ^
2 errors generated.
Extended Description
On the following code clang gives error:
But gcc and msvc compiles this code without any error.