When I compile it with VC++ 2008 I get these warnings:
Code:
1>..\Main.cpp(55) : error C2220: warning treated as error - no 'object' file generated
1>..\Main.cpp(55) : warning C4244: '=' : conversion from 'int' to 'char', possible loss of data
1>..\Main.cpp(61) : warning C4244: '=' : conversion from 'int' to 'char', possible loss of data
Maybe they're using a compiler extension that gcc doesn't use?
BTW, they also forgot to #include <cstring>
The MSDN isn't really known for their high quality code.
The Comeau compiler agrees with gcc.
I got it to work by changing this:
Code:
template<class T>
friend Array<T>* combine(Array<T>& a1, Array<T>& a2);
to this:
Code:
template<class T1>
friend Array<T1>* combine(Array<T1>& a1, Array<T1>& a2);