This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: c++ template conformance: gcc vs MS
[Sorry, I pasted the wrong compiler output (but for the same bug).
Below is the corrected e-mail. ]
I've come across a possible issue with GCC's adherence to the C++
standard for handling template code (gcc version 4.3.2 20081105 from
Fedora 10).
The following code compiles fine under GCC (using -pedantic and
-std=c++98), but fails under Microsoft's C++ 2008 SP1.
Microsoft explains this on
http://msdn.microsoft.com/en-us/library/cx7k7hcf(VS.80).aspx
Is GCC or Microsoft at fault ?
Code (from a header file):
template<typename T1>
struct get_num_type
?{ typedef T1 num_type; };
template<> ?// this line causes the problem
template<typename T2>
struct get_num_type< std::complex<T2> >
{ typedef T2 num_type; };
MS compilers gives:
error C2910: 'get_num_type<std::complex<_Other>>' : cannot be
explicitly specialized