Clang VS VC++:“error: declaration of 'T' shadows template parameter”
I was trying to compile the following code for the classic copy&swap idiom on my Mac with clang 3.3 template<typename T> class node{ private: node<T>* left; node<T>* right; T value; public: friend void swap(node<T>&, node<T>&); // other stuff } Yet the linker complained. I now understand that I should declare the function as a template. But error would occur if I follow the style as suggested here from MSDN: template <class T> class Array { T* array; int size; public:template<class T> //... template <class T> friend Array<T>* combine(Array<T>& a1, Array<T>& a2); }; I did copy-paste but got the